修改 swiper-wrapper 的偏移值不生效问题

通过js改了swiper-container和swiper-slide的宽度 可是swiper-wrapper的偏移值没有变,该怎么修改?有没有大神帮忙解答一下

var mw=screen.width;
function hengshuping(){
if(window.orientation==180||window.orientation==0){
}
if(window.orientation==90||window.orientation==-90){
var obj=document.getElementById("mw");
var obb=document.getElementsByClassName("swiper-wrapper");
var obc=document.getElementsByClassName("swiper-slide");


obj.style.width=mw+"px";
obj.style.height=mw+"px";
obc[0].style.width=mw+"px";
obc[0].style.height=mw+"px";
obc[1].style.width=mw+"px";
obc[1].style.height=mw+"px";
obc[2].style.width=mw+"px";
obc[2].style.height=mw+"px";
obc[3].style.width=mw+"px";
obc[3].style.height=mw+"px";
obc[4].style.width=mw+"px";
obc[4].style.height=mw+"px";
obc[5].style.width=mw+"px";
obc[5].style.height=mw+"px";
obc[6].style.width=mw+"px";
obc[6].style.height=mw+"px";
obc[7].style.width=mw+"px";
obc[7].style.height=mw+"px";
alert(1)
}
}
$(function(){
hengshuping();
});
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", hengshuping, false);
阅读 3.8k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题