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
Post a Comment