Changing a class name with jquery given a specific width range (media query)

前端 未结 3 912
一个人的身影
一个人的身影 2020-12-30 10:49

I have the following html that I am trying to modify:

I

3条回答
  •  执念已碎
    2020-12-30 10:55

    You can do something like:

    var x = $('#myelement'); // this is your element
    var w = $(window).width();
    if(w >= 700 && w <= 900) {
        x.removeClass('class-to-remove').addClass('class-to-add');
    }
    

提交回复
热议问题