swiper的延迟加载(非官网方法)
网上找的: https://github.com/nolimits4web/Swiper/issues/626
var tabsSwiper = new Swiper('#games-content',{
onlyExternal : true,
speed:,
onSlideChangeStart : function(swiper) {
$( ".swiper-slide-active img" ).each(function ( index ) {
var src = $( this ).attr( "data-src" );
$(this).attr("src", src);
$(this).fadeOut().fadeIn();
})
}
})
//Load the First images
$( ".swiper-slide-active img" ).each(function ( index ) {
var src = $( this ).attr( "data-src" );
$(this).attr("src", src);
$(this).fadeOut().fadeIn();
})
自己写的swiper2的延迟加载
var bannerSwiper = new Swiper('.banner_picbox', {
pagination: '.banner_picfocus',
speed: ,
loop: true,
autoplay: ,
paginationClickable: true,
// 当Swiper初始化完成
onSwiperCreated: function(swiper){
var current = $(".swiper-slide-active");
var origSrc = current.find("img").attr("src");
var dataSrcnext = current.next().find("img").attr("data-src");
current.next().find("img").attr("src", dataSrcnext);
},
// 当碰触到slider时执行
onSlideChangeStart : function(swiper) {
// $( ".swiper-slide-active img" ).each(function ( index ) {
// var dataSrc = $(this).attr("data-src");
// var origSrc = $(this).attr("src");
// if(dataSrc !== origSrc){
// $(this).attr("src", dataSrc);
// }
// })
var current = $(".swiper-slide-active");
var origSrc = current.find("img").attr("src");
var dataSrc = current.find("img").attr("data-src");
var dataSrcprev = current.prev().find("img").attr("data-src");
var dataSrcnext = current.next().find("img").attr("data-src");
current.find("img").attr("src", dataSrc);
current.prev().find("img").attr("src", dataSrcprev);
current.next().find("img").attr("src", dataSrcnext);
}
})
bannerWrap.hover(function(){
bannerSwiper.stopAutoplay();
},function(){
bannerSwiper.startAutoplay();
});
prev.on("click", function (e) {
e.preventDefault();
bannerSwiper.swipePrev();
})
next.on("click", function (e) {
e.preventDefault();
bannerSwiper.swipeNext();
})
swiper的延迟加载(非官网方法)的更多相关文章
- Ubuntu14.04下Mongodb官网安装部署步骤(图文详解)(博主推荐)
不多说,直接上干货! 在这篇博客里,我采用了非官网的安装步骤,来进行安装.走了弯路,同时,也是不建议.因为在大数据领域和实际生产里,还是要走正规的为好. Ubuntu14.04下Mongodb(离线安 ...
- Ubuntu16.04下Mongodb官网安装部署步骤(图文详解)(博主推荐)
不多说,直接上干货! 在这篇博客里,我采用了非官网的安装步骤,来进行安装.走了弯路,同时,也是不建议.因为在大数据领域和实际生产里,还是要走正规的为好. Ubuntu16.04下Mongodb(离线安 ...
- Spring官网下载dist.zip的几种方法
Spring官网下载dist.zip的几种方法 Spring官网改版后,很多项目的完整zip包下载链接已经隐掉了,虽然Spring旨在引导大家用更“高大上”的maven方式来管理所依赖的jar包, ...
- Spring官网jar包下载方法
Spring官网改版后,很多项目的完整zip包下载链接已经隐掉了,虽然Spring旨在引导大家用更“高大上”的maven方式来管理所依赖的jar包,但是完全没想到中国的国情,在伟大的墙内,直接通过ma ...
- Jquery各版本下载,附Jquery官网下载方法
jQuery version 2.1.1 http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.js http://ajax.aspnetcdn.com ...
- surface 其实是UEFI与BIOS并存,借用官网的进入方法(少有更改)
surface 其实是UEFI与BIOS并存,借用官网的进入方法(少有更改) 第一种: 1. Swipe in from the right edge of the screen, and ...
- Spring众多jar包的特点,及Spring jar包官网下载方法
下面给大家说说spring众多jar包的特点吧,无论对于初学spring的新手,还是spring高手,这篇文章都会给大家带来知识上的收获,如果你已经十分熟悉本文内容就当做一次温故知新吧.spring. ...
- 官网下载Git方法
最近去官网下载Git,奇慢,下到一半直接挂掉,挂VPN也是一样 https://git-scm.com/ 今天学到一个方法,下载速度可以达到2m/s,那就是复制下载地址,用迅雷下载,可能是迅雷有P2 ...
- 2018年7月份,python上传自己的包库到pypi官网的方法
最近pypi官网进行了更新,老的上传网址作废了.记录下上传到pypi的方法 0.去pypi官网注册账号,没账号是不可能上传的,想想也是那不乱套了吗,注册后会收到一个邮件需要点击然后重新登录 1.目录就 ...
随机推荐
- DataRowState、AcceptChanges、RejectChanges综合使用示例:实现DataGridView数据的增、删、改
下面的示例中,通过一个程序,演示使用DataRowState.AcceptChanges.RejectChanges,实现DataGridView数据的增.删.改. 一.界面设计 二.代码实现 usi ...
- Firefox 在LR录制过程中添加例外的问题解决方法
用lr调火狐打开网页 会报证书安全问题 证书安全提示目的是告诉你这个服务器使用的证书可能不安全,要不要信任,你自己决定,不信任就不能访问.为什么会报证书安全,因为浏览器没添加该证书.或者由于性能工具 ...
- there are 0 datanode.....
当时执行hive的导入数据load data inpath "XXXX" into table.....的时候发现总是导不进去,最后试了下简单的从Linux 到 HDFS上传文件 ...
- 有2个表,结构相似,有一个字段关联,现在怎么把A表的数据添加到B表中,条件是A表不在B表的数据?? 请各位高手多多指点,是oracle的数据库
: insert into b(col1,col2 )select col1,col2 where not exists(select a.col1 from a where a.col1 = b.c ...
- Linux之zip压缩
1.压缩 对于test目录,使用 zip -rq test.zip test r表示递归压缩,q表示不显示过程 2.解压缩 unzip -q test.zip
- C# HttpRequest基础连接已经关闭: 接收时发生意外错误
在c#中使用HttpWebRequest时,频繁请求一个网址时,过段时间就会出现“基础连接已经关闭: 接收时发生意外错误”的错误提示. 将webRequest的属性设置成下面的,经测试可以解决. we ...
- Ubuntu telnet
首先在Ubuntu中安装xinetd(它是inetd替代品): sudo apt-get install xinetd 再安装telnetd,在Ubuntu中没有telnetd这个软件包,它是包含在i ...
- sdut2852 小鑫去爬山9dp入门)
#include<stdio.h> int a[100][100]; int main() { int n; while(scanf("%d",&n)!=EOF ...
- c++ const enum #define
最后的最后,我们略微总结一下: 1.只是声明单一固定值,尽可能采用const. 2.如果是一组固定值,并且互相有关联,则采用enum. 3.不涉及条件编译,只 ...
- sourcetree管理git
下载地址: https://www.sourcetreeapp.com/ 跳过注册: 到注册登录页面打开文件目录%LocalAppData%\Atlassian\SourceTree\ 会发现有个文件 ...