html - CSS slider doesn't scroll on mobile
问题描述
I am working on a new template site over a week now and i cant get my slider work on a mobile. I optimised how it should look but i cant scroll down on the slider on mobile the rest of the site works perfectly. I tried the touch-action: auto; -ms-touch-action: auto; in the slider div but its just simply ignoring it. I looked all over the internet but none of the solutions seems to work.
The two arrows and the dots under the slider(red marked in the picture) is touchable and working but whenever i try to scroll over on picture or text no response at all. Mobile screenshot
Could somebody help with it please?
The slider and picture CSS
.moto-widget-slider li img {min-height: 380px}
.moto-widget-slider li {
text-align: center;
width: 100%;
z-index: 50;
display: block;
touch-action: auto;
-ms-touch-action: auto;
}
Here is the slider HTML code
<div class="moto-widget moto-widget-row row-fixed moto-spacing-top-auto moto-spacing-right-auto moto-spacing-bottom-small moto-spacing-left-auto" data-grid-type="sm" data-widget="row" data-spacing="aasa" style="">
<div class="container-fluid">
<div class="row" data-container="container">
<div class="moto-widget moto-widget-row__column moto-cell col-sm-12 moto-spacing-top-auto moto-spacing-right-auto moto-spacing-bottom-auto moto-spacing-left-auto" style="" data-widget="row.column" data-container="container" data-spacing="aaaa">
<div class="moto-widget moto-widget-container moto-container_header_5a5731da1" data-widget="container" data-container="container" data-css-name="moto-container_header_5a5731da1">
<div data-widget-id="wid_1515683748_4wypf2kcg" class="moto-widget moto-widget-slider moto-preset-default moto-spacing-top-auto moto-spacing-right-auto moto-spacing-bottom-auto moto-spacing-left-auto" data-widget="slider" data-preset="default">
<div class="bx-wrapper" style="max-width: 100%;">
<div class="bx-viewport" aria-live="polite" style="width: 100%; overflow: hidden; position: relative; height: 480px;">
<ul class="moto-widget-slider-list" data-moto-slider-options="{"slideshowEnabled":true,"slideshowDelay":5,"slideshowAnimationType":"fade","showNextPrev":true,"showPaginationDots":true,"showSlideCaptions":true,"itemsCount":3}" style="width: auto; position: relative;">
<li aria-hidden="false" style="height: 480px; float: none; list-style: none; position: absolute; width: 461px; z-index: 50; display: block;">
<div class="slider-text">Hiere is the Güde bla bla bla bla bla Text and lore ipsum bla bla bla bla bla</div>
<a href="param=SHOP&parameter=PAGE&artref=40473&command=3"><img src="../home/ivr/sliders/40473_bestes_produkt_2018_neu.jpg" alt="slider1-min.png"></a>
</li>
<li aria-hidden="true" style="height: 480px; float: none; list-style: none; position: absolute; width: 461px; z-index: 0; display: none;">
<div class="slider-text">Hiere is the Güde WM bla bla bla bla bla Text and lore ipsum bla bla bla bla bla</div>
<a href="http://www.guede.com/artwork/upload/guede/guede_wm_spielplan_2018.pdf"><img src="../home/ivr/sliders/wm_2018_neu.jpg" alt="slider1-min.png"></a>
</li>
<li aria-hidden="true" style="height: 480px; float: none; list-style: none; position: absolute; width: 461px; z-index: 0; display: none;">
<div class="slider-text">Hiere is the Güde Best of 2018 bla bla bla bla bla Text and lore ipsum bla bla bla bla bla</div>
<a href="param=SHOP&parameter=PAGE&artref=18033&command=3"><img src="../home/ivr/sliders/18033_best_of_2018_neu.jpg" alt="slider1-min.png"></a>
</li>
<li aria-hidden="true" style="height: 480px; float: none; list-style: none; position: absolute; width: 461px; z-index: 0; display: none;">
<div class="slider-text">Hiere is the Güde Hebetechnik bla bla bla bla bla Text and lore ipsum bla bla bla bla bla</div>
<a href="param=SHOP&parameter=PAGE&tid=700000&command=3"><img src="../home/ivr/sliders/hebetechnik_2017_neu.png" alt="slider1-min.png"></a>
</li>
</ul>
</div>
<div class="bx-controls bx-has-controls-direction bx-has-pager">
<div class="bx-controls-direction"><a class="bx-prev" href="">Prev</a><a class="bx-next" href="">Next</a></div>
<div class="bx-pager bx-default-pager">
<div class="bx-pager-item"><a href="" data-slide-index="0" class="bx-pager-link active">1</a></div>
<div class="bx-pager-item"><a href="" data-slide-index="1" class="bx-pager-link">2</a></div>
<div class="bx-pager-item"><a href="" data-slide-index="2" class="bx-pager-link">3</a></div>
<div class="bx-pager-item"><a href="" data-slide-index="3" class="bx-pager-link">4</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Also a link from the original site, its the big slider right under the MENU. Maybe easier for somebody with chrome and inspect element
解决方案
似乎您正在使用 bxslider,其中有一个设置名称 preventDefaultSwipeY 如果设置为 true,则不允许屏幕沿 y 轴移动。因此,在您的滑块配置中将其设置为 false。
$('.moto-widget-slider-list').bxSlider({
preventDefaultSwipeY: false;
});
推荐阅读
- ruby-on-rails - 无法解释后端的 /service-worker 调用
- python - 如何在 PyQt5 中用鼠标在图像上绘制矩形
- python - 递归执行自身的 Python 文件
- sql - SQL插入重复项
- amazon-web-services - com.mysql.cj.jdbc.exceptions.CommunicationsException:在 aws cicd 管道构建期间通信链接失败
- html - 当 box-sizing 是 content-box 时,为什么宽度包括边框?
- python - QListWidget 点击检查项目类型
- html - 全高侧导航栏在带 Flex 或 w3.css 的小屏幕上移动到主 div 下方
- reactjs - 菜单显示和折叠时平滑过渡
- permalinks - 11ty 分页返回文件结构中的数字 - 我如何防止这种情况发生?