I want to add the following jquery in external javascript file.
我想在外部javascript文件中添加以下jquery。
$("a[href='#c4']").click(function() {
$("html, body").animate({ scrollTop: 0 }, 2500);
return false;
});
});
How to execute this in html file?.Help me...
如何在html文件中执行此操作?。帮助我...
2 个解决方案
#1
1
First include jquery file in your html and then just include your external file after your jquery file in your html page like this:
首先在你的html中包含jquery文件,然后在你的html页面中包含你的外部文件,如下所示:
<head>
<script src="your_jquery_file.js"></script>
<script src="yourexternalfile.js"></script>
</head>
#2
1
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1>Hello World</h1>
<script type="text/javascript" src="path/to/jquery.js"></script>
<script type="text/javascript" src="path/to/your/jsFile.js"></script>
</body>
</html>
#1
1
First include jquery file in your html and then just include your external file after your jquery file in your html page like this:
首先在你的html中包含jquery文件,然后在你的html页面中包含你的外部文件,如下所示:
<head>
<script src="your_jquery_file.js"></script>
<script src="yourexternalfile.js"></script>
</head>
#2
1
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1>Hello World</h1>
<script type="text/javascript" src="path/to/jquery.js"></script>
<script type="text/javascript" src="path/to/your/jsFile.js"></script>
</body>
</html>