hlzyWeb/Templates/common/script/slider.js

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

 


function gundong(e) {
    e.stopPropagation();
    e.preventDefault();
}
function InitDom(obj) {
 
    this.warp = document.getElementById(obj.warp);
    this.ChildrenLi = this.warp.getElementsByTagName('li');
 
    this.boxHeight = window.innerHeight;
    this.boxWidth = window.innerWidth;
    this.idx = 0;
   
  
    this.InitWarp();
    this.BindEvent();
    this.foranimation(0);
}
InitDom.prototype.InitWarp = function () {
    var len = this.ChildrenLi.length;
    var ChildrenLi = this.ChildrenLi;
    var boxHeight = this.boxHeight;
	var boxWidth = this.boxWidth;
    for (var i = 0; i < len; i++) {
        ChildrenLi[i].style.webkitTransform = 'translate3d(' + i * boxWidth + 'px,0px,0px)';
    }
    ;
};

//绑定事件
InitDom.prototype.BindEvent = function () {
    var BindEventThis = this;
    var boxHeight = this.boxHeight;
    var boxWidth = this.boxWidth;
    var warp = this.warp;

    var tcstart = function (event) {//点击
        BindEventThis.startX = event.touches[0].pageX;
        BindEventThis.offsetX = 0;

    };
    var tcmove = function (event) {//移动
        event.preventDefault();
        BindEventThis.offsetX = event.touches[0].pageX - BindEventThis.startX;
        var ChildrenLi = BindEventThis.ChildrenLi;
        var i = BindEventThis.idx - 1;
        var m = i + 3;

        for (i; i < m; i++) {
            ChildrenLi[i] && (ChildrenLi[i].style.webkitTransform = 'translate3d(' + ((i - BindEventThis.idx) * boxWidth + BindEventThis.offsetX) + 'px,0px,0px)');
            ChildrenLi[i] && (ChildrenLi[i].style.webkitTransition = 'none');
        }


    };
    var tcend = function (event) {//离开
        var boundary = boxWidth / 6;
后面还有 49 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。