swiper

swiper选项卡还可以左右滑动,最后一个直接跳转链接

[亡魂溺海] 提交于 2019-11-26 18:02:36
整理分享: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Swiper demo</title> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.0/css/swiper.min.css"> <style> *{margin:0;padding:0} body,html{ max-width: 640px; margin: 0 auto; background-color: #ebebeb;} a{ text-decoration: none; color: #333 } li{list-style:none} .swiper_tab{ overflow: hidden; font-size: 18px; font-weight: 700; background-color: #fff; height: 40px; line-height: 40px; overflow:

Taro,React,Typescript实现轮播图

走远了吗. 提交于 2019-11-26 12:38:19
Carousel总结 需求:轮播图:自动轮播,漏出下一项的一部分,向左移动,无缝连接切换 项目技术栈为react.js,Taro,typescript 难点:因为技术栈的原因,使用Taro的Swiper组件来写轮播,普通的轮播用这个组件可以完成,但是因为需求需要漏出下一项的一部分,Taro的Swiper组件没有这个属性,小程序的next-margin(在Taro里使用为nextMargin)可以满足这个需求,但是H5端不支持,所以解决方法要么是使用Swiper组件,兼容H5端,要么使用其他容器组件实现。 补充:在小程序或者Taro里,swiper组件的swiper-item组件的宽高默认继承swiper,宽高100%,所以无论怎么改宽度都没用,网上说高可以使用**!impotant**来改(ps:如果能改宽度,那么漏出下一项的一部分这个需求就很容易了,可惜。。。不能) 在开始尝试其他方法之前,我重新看了一遍Taro所有容器组件的文档,如果能使用Taro提供的那是最好的了,看完发现除了pass的Swiper组件,似乎ScrollView能实现。。。 尝试方法一:使用ScrollView实现 经过尝试发现,ScrollView可以实现手动滑动图片的效果,但是要实现自动切换的话,需要使用onScroll这个事件来监听ScrollView容器距离左边的距离,然后使用定时器

微信小程序之视图容器(swiper)组件创建轮播图

非 Y 不嫁゛ 提交于 2019-11-26 10:59:42
一、视图容器(Swiper) 1、swiper:滑块视图容器 微信官方文档:https://developers.weixin.qq.com/miniprogram/dev/component/swiper.html 二、swiper应用 1、页面逻辑(index.js) Page({ data: { imgUrls: [ { link: '/pages/index/index' , url: '/images/001.jpg' }, { link: '/pages/list/list' , url: '/images/002.jpg' }, { link: '/pages/list/list' , url: '/images/003.jpg' } ], indicatorDots: true , // 小点 indicatorColor: "white", // 指示点颜色 activeColor: "coral", // 当前选中的指示点颜色 autoplay: false , // 是否自动轮播 interval: 3000, // 间隔时间 duration: 3000, // 滑动时间 } 其中 imgUrls 是我们轮播图中将要用到的 图片地址和 跳转链接 indicatgorDots 是否出现焦点 autoplay 是否自动播放 interval 自动播放间隔时间

使用canvas在图片上画圆圈,并可点击圆圈在圆圈下方画垂直线(适配移动端)

匆匆过客 提交于 2019-11-26 06:42:10
一、UI 二、实现 <div class="carBrightSpot"> <!-- 轮播图 --> <div class="block-swiper"> <div class="wrapper"> <swiper :options="swiperOption" id="swiper"> <swiper-slide v-for="(item,index) of carImageResult" :key="item.id"> <!-- <img class="swiper-img" :src="item.image"> --> <canvas width="800" height="600" :ref="index" @click="toLineBottom(index)"></canvas> </swiper-slide> </swiper> </div> <!-- 分页器 --> <div class="myPagination"> <div class="swiper-pagination" slot="pagination"></div> </div> </div> <!-- 热区的亮点 --> <div class="brightSpot"> <div class="oneBrightSpot" v-if="curCarHotspotPositionResultList

隐藏的Swiper显示后无法获取正确的宽度和高度

雨燕双飞 提交于 2019-11-26 06:03:41
今天在使用swiper的时候,元素默认是显示的时候没毛病,但是默认是隐藏的状态,再显示的时候发现滑动的时候宽度计算有误,如下图所示: 正确的显示如下: 隐藏的元素再次显示如下: 宽度计算有误 解决方案: var mySwiper = myApp.swiper('.guest-wrapper',{ freeMode : true, slidesPerView : 'auto', observer: true,//修改swiper自己或子元素时,自动初始化swiper observeParents: true//修改swiper的父元素时,自动初始化swiper }); 只需加上后面两行即可。 参数具体含义可看官网说明: http://www.swiper.com.cn/api/Observer/2015/0308/218.html 转载自: https://www.cnblogs.com/sese/p/6699617.html 来源: https://www.cnblogs.com/lhj-blog/p/11316695.html