[英]jQuery Easing function not working here
File Reference(Master Page): 文件参考(母版页):
<script src="JavaScript/jquery-1.10.2.min.js"></script>
<script src="JavaScript/jquery-ui.min.js"></script>
<script src="JavaScript/JavaScript.js" type="text/javascript"></script>
HTML HTML
<a href="#bookmark1" class="rightLinks">Go to 50s</a>
<a id="bookmark1" class="title">50s</a>
Code in JavaScript.js file JavaScript.js文件中的代码
$(".rightLinks").click(function () {
var id = $(this).attr('href');
$('html,body').animate({ scrollTop: (($(id).offset().top) - 30) }, 300, "easeOutCubic");
});
when i remove 'easeOutCubic' it works perfectly: 当我删除'easeOutCubic'时,它可以正常工作:
$(".rightLinks").click(function () {
var id = $(this).attr('href');
$('html,body').animate({ scrollTop: (($(id).offset().top) - 30) }, 300");
});
But why not with the easing function? 但是为什么不使用缓动功能呢?
add this library jquery.easing.min.js : 添加此库jquery.easing.min.js :
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js" type="text/javascript">
</script>
add with your libraries: 添加您的库:
<script src="JavaScript/jquery-1.10.2.min.js"></script>
<script src="JavaScript/jquery-ui.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js" type="text/javascript">
</script>
<script src="JavaScript/JavaScript.js" type="text/javascript"></script>
You must need to add reference of jQuery UI 1.10
in your master page, that's it! 您必须在母版页中添加jQuery UI 1.10
引用,仅此而已!
You can download it from here http://jqueryui.com/download/ 您可以从此处http://jqueryui.com/download/下载
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.