好吧,我在同一页面上使用了多个 jQuery 滑块,不知何故我设法使它工作,但现在还有另一个问题:
http://www.tradeglobus.com/index2.php
手风琴菜单:http: //jqueryui.com/accordion/#hoverintent
在“Premium Memberships”中的 div 实际上适用于鼠标悬停意图,当我添加“jquery noConflict”时,其他一切都开始工作,但手风琴菜单现在只在 CLICK 事件上工作,而不是在悬停时工作。
这是代码:
<script>
var $accui = jQuery.noConflict(true);
$(function() {
$accui( "#accordion" ).accordion({
event: "click hoverintent"
});
});
var cfg = ($.hoverintent = {
sensitivity: 7,
interval: 50
});
$.event.special.hoverintent = {
setup: function() {
$( this ).bind( "mouseover", jQuery.event.special.hoverintent.handler );
},
teardown: function() {
$( this ).unbind( "mouseover", jQuery.event.special.hoverintent.handler );
},
handler: function( event ) {
var that = this,
args = arguments,
target = $( event.target ),
cX, cY, pX, pY;
function track( event ) {
cX = event.pageX;
cY = event.pageY;
};
pX = event.pageX;
pY = event.pageY;
function clear() {
target
.unbind( "mousemove", track )
.unbind( "mouseout", arguments.callee );
clearTimeout( timeout );
}
function handler() {
if ( ( Math.abs( pX - cX ) + Math.abs( pY - cY ) ) < cfg.sensitivity ) {
clear();
event.type = "hoverintent";
event.originalEvent = {};
jQuery.event.handle.apply( that, args );
} else {
pX = cX;
pY = cY;
timeout = setTimeout( handler, cfg.interval );
}
}
var timeout = setTimeout( handler, cfg.interval );
target.mousemove( track ).mouseout( clear );
return true;
}
};
</script>
你们中的任何人都可以突出显示此代码中的任何错误吗?