【问题标题】:Change class of element on resize window在调整窗口大小上更改元素类
【发布时间】:2022-12-03 15:32:30
【问题描述】:

I search that resize event detect when i resizing the windows, and i know the widht o window can i get it using window.innerWidth or innerWidht

const swiperRooms = document.querySelector(\'#swiperRooms\'); //this contain class mySwiper-rooms
addEventListener(\"resize\", (event) => {
    if(innerWidth < 834) swiperRooms?.classList.toggle(\'mySwiper\');
});

I want to change the class of my swiper(slider) to other class that i have but i dont know why my code doesnt work. Its my first time doing resize

    标签: javascript html typescript class swiper.js


    【解决方案1】:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-28
    • 1970-01-01
    • 1970-01-01
    • 2016-07-07
    • 2013-01-24
    • 2021-04-09
    • 1970-01-01
    相关资源
    最近更新 更多