javascript - How to dynamically change classes when DIV width changes? -
i know how change classes jquery when window size changed, need based on width of div , change dynamically when div's width changes.
$(window).resize(function() { var wrapwidth = $('.info-wrap').width(); if (wrapwidth >= 500) { $('#partone').addclass('big'); $('#parttwo').addclass('big'); } else { $('#partone').removeclass('big'); $('#parttwo').removeclass('big'); } });
this works when window size changes. but, can use insead of $(window).resize width of div changes?
i think you'll need use plugin jquery, such ben alman's plugin.
i don't think there exists detects when div gets resize, window.
Comments
Post a Comment