javascript - Continuity test if statment -


i have if statement looks this:

if ($(window).width() < 799) {     $('.element').css({'display': 'none'}); } else {      $('.element').css({'display': 'block'}); } 

i continuity test statement when window resized, go normal (or other way around). have tried setinterval not seem work nor seem right thing do. i'm aware can use css media queries of this, of code not show can not done in css.

$(window).on('resize', function() {     $('.element').toggle( $(this).width() < 799 ); }).trigger('resize'); // <- fires on pageload 

Comments

Popular posts from this blog

python - Received unregistered task using Celery with Django -

c# - Delving into the world of XML (Windows Phone) Error I dont understand (The ' ' character, hexadecimal value 0x20, cannot be included in a name.) -

Line ending issue with Mercurial or Visual Studio -