|
我的代码是这样的
- <style>
- .swiper-container {
- width: 100%;
- height: 50%;
- }
- .swiper-slide {
- text-align: center;
- font-size: 18px;
- background: #fff;
- /* Center slide text vertically */
- display: -webkit-box;
- display: -ms-flexbox;
- display: -webkit-flex;
- display: flex;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- -webkit-align-items: center;
- align-items: center;
- }
- .swiper-wrapper{
- transition-timing-function: linear !important;
- }
- </style>
- var mySwiper = new Swiper ('.swiper-container', {
- loop: true,
- slidesPerView: 4,
- speed: 15000,//匀速时间
- autoplay: {
- delay: 0,
- stopOnLastSlide: false,
- disableOnInteraction: false,
- }
- });
- $('.swiper_container').mouseenter(function () {
- mySwiper.autoplay.stop();
- });
- // 鼠标移出开始自动滚动
-
- $('.swiper_container').mouseleave(function () {
- mySwiper.autoplay.start();
- })
复制代码 这样可以有跑马灯的效果,但是stop无效了,哪里出了问题呢?
|
|