我为我做的下拉导航制作的jQuery非常跳跃并且不是很流畅。有人可以看看下面的jQuery并告诉我我可以做些什么来修改它并使其尽可能顺利?
由于
jQuery.noConflict();
var time = 0;
jQuery(document).ready(function () {
// mouseenter
jQuery('ul.scmegamenulist li.scmegamenumain').mouseenter(
function openmenu() {
// slideDown / fadeIn / show
if(<?php echo Mage::getStoreConfig('megamenu/jquery/enable',Mage::app()->getStore()); ?> == 1){
var openeffect = <?php echo Mage::getStoreConfig('megamenu/jquery/open',Mage::app()->getStore()); ?>;
var opentime = <?php echo Mage::getStoreConfig('megamenu/jquery/opentime',Mage::app()->getStore()); ?>;
if(openeffect == 1){
jQuery(this).children('div.scmegamenusub').stop(true, true).hide().delay(time).fadeIn(opentime);
}else if(openeffect == 2){
jQuery(this).children('div.scmegamenusub').stop(true, true).hide().delay(time).slideDown(opentime);
}
else if(openeffect == 3){
jQuery(this).children('div.scmegamenusub').stop(true, true).hide().show();
}
else if(openeffect == 4){
jQuery(this).children('div.scmegamenusub').stop(true, true).hide().delay(time).show(opentime);
}
}
}
);
// mouseleave
jQuery('ul.scmegamenulist li.scmegamenumain').mouseleave(
function closemenu() {
// slideUp / fadeOut / hide
if(<?php echo Mage::getStoreConfig('megamenu/jquery/enable',Mage::app()->getStore()); ?> == 1){
var closeeffect = <?php echo Mage::getStoreConfig('megamenu/jquery/close',Mage::app()->getStore()); ?>;
var closetime = <?php echo Mage::getStoreConfig('megamenu/jquery/opentime',Mage::app()->getStore()); ?>;
if(closeeffect == 1){
jQuery(this).children('div.scmegamenusub').stop(true, true).show().fadeOut(closetime);
time = closetime;
}else if(closeeffect == 2){
jQuery(this).children('div.scmegamenusub').stop(true, true).show().slideUp(closetime);
time = closetime;
}else if(closeeffect == 3){
jQuery(this).children('div.scmegamenusub').stop(true, true).show().hide();
time = 0;
}else if(closeeffect == 4){
jQuery(this).children('div.scmegamenusub').stop(true, true).show().hide(closetime);
time = closetime;
}
}
}
);
});