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 -

django - CSRF verification failed. Request aborted. CSRF cookie not set -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -