Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

change class on resize window jquery

$(window).bind("resize", function () {
    console.log($(this).width())
    if ($(this).width() < 500) {
        $('div').removeClass('yellow').addClass('red')
    } else {
        $('div').removeClass('red').addClass('yellow')
    }
}).trigger('resize');
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #change #class #resize #window #jquery
ADD COMMENT
Topic
Name
8+1 =