JQuery - Window resize working on Chrome but not Firefox -


i have code below show larger tracker on wider screens , smaller tracker otherwise, working me in chrome , can't function in firefox.

i'm not familiar jquery, suspect may syntax error chrome more forgiving of haven't been able find error when searching. help.

    $(window).resize(function() {     var wi = $(window).width();      if (wi <= 767){         $('.largertracker').hide();         $('.smallertracker').show();         }     else {         $('.largertracker').show();         $('.smallertracker').hide();         }     }); 

it looks logic fine, can see working example here http://jsfiddle.net/ygxbtt6c/3/

without seeing more code can't tell sure, it's possible need wait dom ready event before binding function window resize event.

$( document ).ready(function() {   // dom ready manipulated, put code here }); 

you can learn more ready event in jquery documentation


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

c# - How do I get the Nth largest element from a list with duplicates, using LINQ? -

jsp - "Sending a redirect is forbidden after the response has been committed" in sendRedirect -