Note that there are some explanatory texts on larger screens.

plurals
  1. POwindow.bind function causing ie7 to not respond because of a long running script
    primarykey
    data
    text
    <p>I'm using the following script for a responsive menu. In IE7 the script makes the page freeze and it says the page "is not responding due to a long running script". I found that the bit causing the freezing is the <code>window.bind</code> portion at the bottom of the code and from my research so far suggests that it's causing an infinite loop in IE7. I've read answers about using setTimeout and such, but I'm very novice and have no idea how to implement this into the script. Any ideas how I can prevent this script from crashing/freezing IE7?</p> <p>Here's a solution that involved the timeout on <a href="http://www.picnet.com.au/blogs/Guido/post/2010/03/04/How-to-prevent-Stop-running-this-script-message-in-browsers" rel="nofollow">this blog post</a>, but I have no idea how to implement it with my script below</p> <pre><code>/* Sample scripts for RWD nav patterns (c) 2012 Maggie Wachs, Filament Group, Inc - http://filamentgroup.com/examples/rwd-nav- patterns/GPL-LICENSE.txt Last updated: March 2012 Dependencies: jQuery */ jQuery(function($){ $('.nav-primary') // test the menu to see if all items fit horizontally .bind('testfit', function(){ var nav = $(this), items = nav.find('a'); $('body').removeClass('nav-menu'); // when the nav wraps under the logo, or when options are stacked, display the nav as a menu if ( (nav.offset().top &gt; nav.prev().offset().top) || ($(items[items.length-1]).offset().top &gt; $(items[0]).offset().top) ) { // add a class for scoping menu styles $('body').addClass('nav-menu'); }; }) // toggle the menu items' visiblity .find('h3') .bind('click focus', function(){ $(this).parent().toggleClass('expanded') }); // ...and update the nav on window events $(window).bind('load resize orientationchange', function(){ $('.nav-primary').trigger('testfit'); }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload