网上找的: 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的延迟加载(非官网方法)的更多相关文章

  1. Ubuntu14.04下Mongodb官网安装部署步骤(图文详解)(博主推荐)

    不多说,直接上干货! 在这篇博客里,我采用了非官网的安装步骤,来进行安装.走了弯路,同时,也是不建议.因为在大数据领域和实际生产里,还是要走正规的为好. Ubuntu14.04下Mongodb(离线安 ...

  2. Ubuntu16.04下Mongodb官网安装部署步骤(图文详解)(博主推荐)

    不多说,直接上干货! 在这篇博客里,我采用了非官网的安装步骤,来进行安装.走了弯路,同时,也是不建议.因为在大数据领域和实际生产里,还是要走正规的为好. Ubuntu16.04下Mongodb(离线安 ...

  3. Spring官网下载dist.zip的几种方法

    Spring官网下载dist.zip的几种方法   Spring官网改版后,很多项目的完整zip包下载链接已经隐掉了,虽然Spring旨在引导大家用更“高大上”的maven方式来管理所依赖的jar包, ...

  4. Spring官网jar包下载方法

    Spring官网改版后,很多项目的完整zip包下载链接已经隐掉了,虽然Spring旨在引导大家用更“高大上”的maven方式来管理所依赖的jar包,但是完全没想到中国的国情,在伟大的墙内,直接通过ma ...

  5. Jquery各版本下载,附Jquery官网下载方法

    jQuery version 2.1.1 http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.js http://ajax.aspnetcdn.com ...

  6. surface 其实是UEFI与BIOS并存,借用官网的进入方法(少有更改)

    surface 其实是UEFI与BIOS并存,借用官网的进入方法(少有更改) 第一种: 1.       Swipe in from the right edge of the screen, and ...

  7. Spring众多jar包的特点,及Spring jar包官网下载方法

    下面给大家说说spring众多jar包的特点吧,无论对于初学spring的新手,还是spring高手,这篇文章都会给大家带来知识上的收获,如果你已经十分熟悉本文内容就当做一次温故知新吧.spring. ...

  8. 官网下载Git方法

    最近去官网下载Git,奇慢,下到一半直接挂掉,挂VPN也是一样 https://git-scm.com/  今天学到一个方法,下载速度可以达到2m/s,那就是复制下载地址,用迅雷下载,可能是迅雷有P2 ...

  9. 2018年7月份,python上传自己的包库到pypi官网的方法

    最近pypi官网进行了更新,老的上传网址作废了.记录下上传到pypi的方法 0.去pypi官网注册账号,没账号是不可能上传的,想想也是那不乱套了吗,注册后会收到一个邮件需要点击然后重新登录 1.目录就 ...

随机推荐

  1. umount 强制卸载

    umount -lf /mnt  强制卸载文件 -f     Force unmount (in case of an unreachable NFS system).  (Requires kern ...

  2. C# 关于JArray和JObject封装JSON对象

    直入主题,不废话... 1.JObject:基本的json对象 /// <summary> /// Gets the j object. /// </summary> /// ...

  3. 运行带distance field的Hiero

    从http://libgdx.badlogicgames.com/releases/下载zip包并解压,切换到解压后的目录,执行: java -cp gdx.jar;gdx-natives.jar;g ...

  4. 03 Files

    本章提要-----------------------------------------------组成 oracle 的 8 种主要文件(包括 instance 和 database)instan ...

  5. 将DataFrame数据如何写入到Hive表中

    1.将DataFrame数据如何写入到Hive表中?2.通过那个API实现创建spark临时表?3.如何将DataFrame数据写入hive指定数据表的分区中? 从spark1.2 到spark1.3 ...

  6. Python if-else and while

    if-elif语法 if condition: [tab键] command elif condition: [tab键] command elif condition: [tab键] command ...

  7. USB2.0学习笔记连载(二):USB基础知识简介

    USB接口分为USB A型.USB B型.USBmini型.USBmicro型.USB3.0其中每种都有相应的插座和插头. 图1 图2 上图是USBA型接口,图1为插座,图2为插头.插座指向下行方向, ...

  8. stos

    add <?php /* 添加脚本 参数:u=用户名 v=城市名 为用户添加城市标签 */ header("Content-Type:text/html; charset=utf-8& ...

  9. C# 在Bitmap上绘制文字出现锯齿的问题

    解决锯齿问题主要是修改Graphics的属性 修复绘制图片锯齿问题可以修改 g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiA ...

  10. e660. 用一组像素创建图像

    This example demonstrates how to convert a byte array of pixel values that are indices to a color ta ...