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

javascript - CasperJS/PhantomJS failing SSL handshakes on some sites even with --ssl-protocol=any -

codeigniter - Fatal error: Call to undefined function lang() in CI Merchant using CardSave -

python - Received unregistered task using Celery with Django -