javascript - Recursive Animation throwing : Maximum call stack size exceeded -
we trying upgrade jquery used in our webpages 1.8 1.10.1 broke of features in page. able isolate actual code , suprised see that. recursive animation code running before throwing error. below code.
<script> $(document).ready(function(){ glowopenitems(500); }); function glowopenitems(duration){ $('#dialog').addclass('glowed',duration, function(){ $(this).removeclass('glowed',duration,function(){glowopenitems(duration)}); }); } </script> <style> .glowed{ box-shadow: 0px 0px 40px 3px #e14f1c; } </style> <div id="dialog" title="basic dialog"> <p>test code</p> </div> on farther investigation found thing works
$(document).ready(function(){ animate(); }); function animate() { $('#dialog').animate({backgroundcolor:'#ffcc00'}, 500, function(){ $('#dialog').animate({backgroundcolor:'#3b5998'}, 500, function(){ animate(); }); }); } but whenever changing animate method addclass getting "uncaught rangeerror: maximum phone call stack size exceeded ". seems there changes in addclass of jquery. help appreciated.
consider part:
$j('[id$="highlightpanelopenrequireditems"]').removeclass('glowed',duration,glowopenitems(duration)); i guess should set glowopenitems(duration) in inline function:
$j('[id$="highlightpanelopenrequireditems"]').removeclass('glowed',duration,function(){glowopenitems(duration);}); also, should not execute jquery selector many times. consider assigning selected jquery objects variable , reuse it.
javascript jquery jquery-ui
No comments:
Post a Comment