任何人都可以弄清楚为什么这段代码会影响我所有的其他jquery脚本。 这是一个从左到右的导航,但是在实施时会打破我的其他toogles。
<script type="text/javascript">
var $fee = jQuery.noConflict();
$fee('.left-nav-links').css({"width":"60px"});
var already_open = 0;
$fee(document).on("mouseover",".left-nav-links > li",function(){
if(already_open==0){
already_open = 1;
$fee('.left-nav-links').stop();
$fee('.left-nav-links').animate({"width":"192px"}, 1000);
}
}).on("mouseout", ".left-nav-links > li",function(){
if(already_open==1){
already_open = 0;
$fee('.left-nav-links').stop();
$fee('.left-nav-links').animate({"width":"60px"}, 1000);
}
})
$fee('#setting-popup-btn').click(function() {
$fee('.dropdown-profile').toggle();
});
$fee('#setting-popup-btn2').click(function(){
$fee('.dropdown-profile').toggle();
});
</script>
答案 0 :(得分:0)
var $fee = jQuery.noConflict();
$fee('.left-nav-links').css({"width":"60px"});
var already_open = 0;
$fee(document).on("mouseover",".left-nav-links > li",function(){
if(already_open==0){
already_open = 1;
$fee('.left-nav-links').stop();
$fee('.left-nav-links').animate({"width":"192px"}, 1000);
}
}).on("mouseout", ".left-nav-links > li",function(){
if(already_open==1){
already_open = 0;
$fee('.left-nav-links').stop();
$fee('.left-nav-links').animate({"width":"60px"}, 1000);
}
}) // missing semi-colon HERE
$fee('#setting-popup-btn').click(function() {
$fee('.dropdown-profile').toggle();
});
$fee('#setting-popup-btn2').click(function(){
$fee('.dropdown-profile').toggle();
});