javascript - Combine scroll and resize events after document is ready -


in example things work nice, when scrolling in large window width resize small window div still take .fixed class

so it's working when scroll 0px(top), not when resizing window small size while scroll more 0px

i want remove .fixed class when detecting scroll 0 , window less 600px if document loaded

example: http://jsbin.com/arehow/1/edit

your condition wrong.

if ( $(window).width() > 600 ) {             $('div').addclass('fixed');         }     } else {         if ( $(window).width() > 600 ) {             $('div').removeclass('fixed');         }     } 

both conditions >600 ... make last condition < 600


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -