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

Line ending issue with Mercurial or Visual Studio -

java - Jtable duplicate Rows -

java - Run a .jar on Heroku -