我需要在jQuery的链接中添加一个效果,但它只适用于min 1.7.1,而且我有另一个只在1.10.2中有效的代码。
此代码仅适用于1.10.2
$(document).ready(function(){
var menu = document.querySelector('#menu-bar-wrapper');
var origOffsetY = menu.offsetTop;
function scroll () {
if ($(window).scrollTop() >= origOffsetY) {
$('#menu-bar-wrapper').addClass('sticky');
$('#latest-wrapper').addClass('menu-padding');
} else {
$('#menu-bar-wrapper').removeClass('sticky');
$('#latest-wrapper').removeClass('menu-padding');
}
}
document.onscroll = scroll;
});
和1.7.1中的工作:
$(document).ready(function(){
$('.block-content ul.menu li').hover(function(event) {
$(this).stop().animate({ marginRight: "5px" }, {duration: 'slow',easing: 'easeOutElastic'});
},function(){
$(this).stop().animate({ marginRight: "0px" }, {duration: 'slow',easing: 'easeOutElastic'});
});
});
当我打开我的网站时,这两个代码无效并向我显示此错误:
TypeError: jQuery.easing[this.easing] is not a function
percent, this.options.duration * percent, 0, 1, this.options.duration
我能做些什么来解决它?
答案 0 :(得分:11)
您需要为扩展的缓动选项包含jQueryUI。请看一下这个链接。
答案 1 :(得分:1)
a{
color: #666;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
}
a:hover{
cursor: pointer;
color: #000;
text-decoration: none;
}
这种方式在css中
答案 2 :(得分:0)
您必须在jQuery UI下载构建器中包含效果核心才能解决此错误。