移动端网页触摸内容滑动js插件Swiper的使用(项目总结)
来源:互联网 发布:软件即征即退 编辑:程序博客网 时间:2024/04/29 23:44
首先这是一个不错的移动端网页触摸内容滑动js插件,以前的时候很少用到这样的插件,又丰富了知识,Swiper一个非常不错的插件
<div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide"><img src="theme/css/images/home/banner2.jpg"> </div> <div class="swiper-slide"><img src="theme/css/images/home/banner1.jpg"> </div> <div class="swiper-slide"><img src="theme/css/images/home/banner.jpg"></div> </div> <div class="swiper-pagination"></div></div>
//bannervar mySwiper = new Swiper('.swiper-container', { loop: true, autoplay: 3000, pagination: '.swiper-pagination'});看Swiper 的api文档很容易看懂的,关键还是靠平时的积累。
loop英文意思是环形的意思,如果设置为true的话,就是循环播放的意思。
autoplay英文意思是自动播放,也就是自动播放和自动滑动的间隔时间为3000微秒
pagination: '.swiper-pagination'
<divclass="swiper-pagination"></div>
就是控制图片滑动下方的几个小点
var mySwiper = new Swiper('.swiper-container', { loop: true, autoplay: 3000, pagination: '.swiper-pagination'});其中有很多配置选项,可以根据Swiper 的api文档配合自己的需求进行添加。
// 在用angular开发h5页面的时候又用到了,所以就把angular中怎么用的也总结下来
html 页面
<div class="notice"> 公告 <div class="notice_container swiper-container" ng-show="news.length>0"> <div class="swiper-wrapper"> <div class="swiper-slide" ng-repeat="index in news" ui-sref="noticeDetail({id:index.id})"> <span>{{index.title}}</span> </div> </div> </div></div><ion-content class="home_content"> <div class="banner_content"> <div class="banner_box swiper-container" ng-show="banner.length>0"> <div class="swiper-wrapper"> <div class="swiper-slide" ng-repeat="index in banner" ui-sref="{{index.link}}"> <img ng-src="{{index.src}}" alt=""> </div> </div> <div class="swiper-pagination"></div> </div> </div></ion-content>js页面
starter.controller("homeCtrl", function ($scope,$timeout,httpSvc) { var params = { notice_type: 01 , query_begin_line: 1, query_num:100, head_tran_code: "S40001" } $scope.banner=[{src:'../img/banner.png',link:'funds'},{src:'../img/banner.png',link:'funds'},{src:'../img/banner.png',link:'funds'}]; $scope.news=[]; httpSvc.post("/system/sysNoticeListS",params).then(function(data){ console.log(data,data.respBody.list[0]) var timestamp = Date.parse(new Date()); for (var i = 0; i < data.respBody.list.length; i++) { var endStamp=Date.parse(moment(data.respBody.list[i].notice_effcenddate+data.respBody.list[i].notice_effcendtime, "YYYYMMDDHHmmss").format()) if (endStamp>timestamp) { $scope.news.push({ id:data.respBody.list[i].notice_serno, title:data.respBody.list[i].notice_title }) } } }) $timeout(function(){ var banner = new Swiper('.banner_box',{ loop: true, observer:true, loopAdditionalSlides:2, autoplay:3000, pagination:'.swiper-pagination', paginationClickable :false, autoplayDisableOnInteraction : true }); var notic = new Swiper('.notice_container',{ loop: true, observer:true, direction:'vertical', loopAdditionalSlides:2, autoplay:3000, paginationClickable :false, autoplayDisableOnInteraction : true }); },100);})其中第一个是公告轮播,第二个是轮播图,所以是有区别的,这也是我为什么总结下来的原因,第一个公告轮播的时候,是直接在
swiper-slide中定义的,不需要定义,其他的区别不大。所以要灵活运用<div class="swiper-pagination"></div>
阅读全文
1 0
- 移动端网页触摸内容滑动js插件Swiper的使用(项目总结)
- swiper-移动端网页触摸内容滑动js插件
- swiper:前应用较广泛的移动端网页触摸内容滑动js插件
- Swiper常用于移动端网站的内容触摸滑动
- Swiper常用于移动端网站的内容触摸滑动
- Swiper移动端网站的内容触摸滑动
- 移动端触摸滑动插件Swiper
- 移动端触摸滑动插件Swiper
- 轮播组件Swiper实现移动端网站的内容触摸滑动使用方法
- 开源,免费的移动端触摸滑动插件------swiper介绍----淘抢购时间选择加载产品
- 开源,免费的移动端触摸滑动插件------swiper介绍----淘抢购时间选择加载产品
- 三个超实用的移动端触摸滑动js插件
- Swiper.js – 移动WEB页面内容触摸滑动类库
- 手机端触摸滑动(H5+CSS3+JS+Swiper)
- [JS插件] Swiper:强大的触摸滑动&整屏滚动插件
- Angular.js中使用Swiper插件不能滑动的解决方案
- js滑动特效插件Swiper使用心得
- SwiperJS 插件 常用于移动端网站的内容触摸滑动
- 琐碎的知识点(xly)
- 自己的mysql数据库给局域网用户所有的权限
- 07-图6 旅游规划 (25分)
- mybatis自动生成映射实体类
- WaitForSingleObject实际使用中犯的错
- 移动端网页触摸内容滑动js插件Swiper的使用(项目总结)
- HTTP协议原理
- python 的文件操作
- C++编码转换
- 怎样做好Java系统程序员?
- 湖南长沙房卡麻将学习 一,免费下载、环境搭建和编译
- 精通CSS(4.3投影)&黑客与画家(序&书呆子)
- android 模糊查找,并标红关键字实现
- Can't start Git:git.exe