too much recursion jquery
I've got an issue of too much recursion with jquery and in IE a pop up stack overflow, what it can be?
Here my code
Html :
<div id="leiki_tabs">
<div id="leiki_container">
<ul id="leiki_menu">
<li style="width:100px;border-right:1px dotted #333;border-bottom:1px dotted #333;text-align:center;"><a id="title_leiki_panel_1" href="#" rel="leiki_panel_1">Today</a></li>
<li style="width:100px;border-right:1px dotted #333;border-bottom:1px dotted #333;text-align:center;"><a id="title_leiki_panel_2" href="#" rel="leiki_panel_2">This Month</a></li>
<li style="width:100px;border-right:1px dotted #333;border-bottom:1px dotted #333;text-align:center;"><a id="title_leiki_panel_3" href="#" rel="leiki_panel_3">Archive</a></li>
<li style="width:270px;"/>
<li id="leiki_logo_tab_menu"><a href="#" rel="leiki_panel_5" ><img id="leiki_logo" style="border:0px;" src="leikiLogo_onMouseOver.png"/></a></li>
</ul>
</div>
<!--Panel Contents Start-->
<div id="leiki_panel_1" class="leiki_panel">
<ul class="leiki_panel_ul">
<li class="leiki_panel_li"><div class="leiki_left"><Article 1</div></li>
<li class="leiki_panel_li"><div class="leiki_left">Article 2</div></li>
<li class="leiki_panel_li"><div class="leiki_left">Article 3</div></li>
<li class="leiki_panel_li"><div class="leiki_left">Article </div></li>
<li class="leiki_panel_li"><div class="leiki_left">Article 5</div></li>
</ul>
</div>
Javascript :
var opened_one = null;
$(function(){
$('div[id*="leiki_panel"]').hide();
$('div[id="leiki_panel_1"]').show();
$('#title_leiki_panel_1').addClass("leiki_menu_highlight");
$('#leiki_menu a').mouseenter(function(){
$('a[id*="title_leiki_panel"]').removeClass("leiki_menu_highlight");
if(opened_one==null){$('div[id="leiki_panel_1"]').hide();}
$(opened_one).hide();
var link_rel = $(this).attr('rel');
$('div#' + link_rel).show();
opened_one = $('div#' + link_rel);
开发者_Go百科 var tab = "title_" +link_rel;
}).mouseleave(function(){
var link_rel = $(this).attr('rel');
var tab = "title_" +link_rel;
if(tab=="title_leiki_panel_1" ||
tab=="title_leiki_panel_2" ||
tab=="title_leiki_panel_3" ||
tab=="title_leiki_panel_4" ||
tab=="title_leiki_panel_5"){
$("#"+tab).addClass("leiki_menu_highlight");}
});
});
It's working on my desktop without problem but on the test server which is owned by our customer it give me this error too much recursion. I cant post the address of the test server but maybe in private message.
Cheers
Try changing $('#leiki_menu a').mouseenter(function()
and similar into:
$('#leiki_menu').delegate('a', 'mouseenter', function(){
// ...
}).delegate('a', 'mouseleave', function(){
// ...
});
精彩评论