自适应轮播图,支持手机触屏滑动,三种切换效果。

效果图:

iSlider手机端图片滑动切换插件使用详解

js:

var iSlider = function(opts) {
 if (!opts.dom) {
  throw new Error("dom element can not be empty!");
 }
 if (!opts.data || !opts.data.length) {
  throw new Error("data must be an array and must have more than one element!");
 }
 this._opts = opts;
 this._setting();
 this._renderHTML();
 this._bindHandler();
};
iSlider.prototype._setting = function() {
 var opts = this._opts;
 this.wrap = opts.dom;
 this.data = opts.data;
 this.type = opts.type || 'pic';
 this.isVertical = opts.isVertical || false;
 this.onslide = opts.onslide;
 this.onslidestart = opts.onslidestart;
 this.onslideend = opts.onslideend;
 this.onslidechange = opts.onslidechange;
 this.duration = opts.duration || 4000;
 this.log = opts.isDebug "X") "Y": "X";
  var absoluteOffset = Math.abs(offset);
  var bdColor = window.getComputedStyle(this.wrap.parentNode, null).backgroundColor;
  if (this.isVertical) {
   offset = -offset;
  }
  this.wrap.style.webkitPerspective = scale * 4;
  if (i == 1) {
   dom.style.zIndex = scale - absoluteOffset;
  } else {
   dom.style.zIndex = (offset > 0) "X") "Y": "X";
  var bdColor = window.getComputedStyle(this.wrap.parentNode, null).backgroundColor;
  if (this.isVertical) {
   offset = -offset;
  }
  this.wrap.style.webkitPerspective = scale * 4;
  if (offset > 0) {
   dom.style.visibility = (i > 1) "X") "Y": "X";
  var zoomScale = (4 - Math.abs(i - 1)) * 0.15;
  this.wrap.style.webkitPerspective = scale * 4;
  if (i == 1) {
   dom.style.zIndex = 100;
  } else {
   dom.style.zIndex = (offset > 0) "X") "Y": "X";
  var zoomScale = 1 - (Math.abs(i - 1) * 0.2);
  this.wrap.style.webkitPerspective = scale * 4;
  if (i == 1) {
   dom.style.zIndex = 100;
  } else {
   dom.style.zIndex = (offset > 0) "' + this.height + '" src="/UploadFiles/2021-04-02/' + item.content + '">
<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>Document</title>
 <style type="text/css">
  *{
   padding: 0;
   list-style: none;
   margin: 0;
  }
  /*容器高度*/
  #iSlider-effect-wrapper {
   height: 400px;
   width: 500px;
   margin: 0 auto;
   margin-top: 4.6rem;
   overflow: hidden;
   position: relative;
  }
  .iSlider-effect ul{
   list-style: none;
   padding: 0;
   margin: 0;
   height: 100%;
   overflow: hidden
  }
  .iSlider-effect li {
   position: absolute;
   margin: 0;
   padding: 0;
   height: 100%;
   overflow: hidden;
   display: -webkit-box;
   -webkit-box-pack: center;
   -webkit-box-align: center;
   list-style: none
  }
  .iSlider-effect ul li img {
   max-width: 100%;
   max-height: 100%;
   margin: 0;
   padding: 0
  }
  .iSlider-effect div {
   background-color: #fff;
   padding: 3px
  }
 </style>
</head>
<body>
 <script type="text/javascript" src="/UploadFiles/2021-04-02/mobile_slider.js">

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。