-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
24,001 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
$(function() { | ||
/* 手势切换轮播图*/ | ||
/*1.自动轮播 无缝*/ | ||
/*2.点随着变化*/ | ||
/*3.完成手势切换*/ | ||
var $banner = $('.sn_banner'); | ||
var width = $banner.width(); | ||
// console.log(width); | ||
var $imageBox = $banner.find('ul:first'); | ||
var $pointBox = $banner.find('ul:last'); | ||
var $points = $pointBox.find('li'); | ||
|
||
var animationFuc = function() { | ||
$imageBox.animate({ transform: 'translateX(' + (-index * width) + 'px)' }, 200, function() { | ||
// 动画执行完成的回调 | ||
|
||
if (index >= 9) { | ||
index = 1; | ||
// 瞬间完成 | ||
$imageBox.css({ transform: 'translateX(' + (-index * width) + 'px)' }); | ||
} else if (index <= 0) { | ||
index = 8; | ||
// 瞬间完成 | ||
$imageBox.css({ transform: 'translateX(' + (-index * width) + 'px)' }); | ||
} | ||
/*2.点随着变化*/ | ||
$points.removeClass('now').eq(index - 1).addClass('now'); | ||
}); | ||
} | ||
|
||
/*1.自动轮播 无缝*/ | ||
var index = 1; | ||
var timer = setInterval(function() { | ||
index++; | ||
// 动画 | ||
animationFuc(); | ||
}, 3000); | ||
/*3.完成手势切换*/ | ||
/*左滑的手势 下一张*/ | ||
$banner.on('swipeLeft', function() { | ||
clearInterval(timer); | ||
index++; | ||
animationFuc(); | ||
timer = setInterval(function() { | ||
index++; | ||
// 动画 | ||
animationFuc(); | ||
}, 3000); | ||
}); | ||
/*右滑的手势 上一张*/ | ||
$banner.on('swipeRight', function() { | ||
clearInterval(timer); | ||
index--; | ||
animationFuc(); | ||
timer = setInterval(function() { | ||
index++; | ||
// 动画 | ||
animationFuc(); | ||
}, 3000); | ||
}); | ||
|
||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/*变量*/ | ||
@import "var"; | ||
/*混入*/ | ||
@import "mixins"; | ||
/*适配*/ | ||
@import "adapter"; | ||
/*重置样式*/ | ||
@import "reset"; | ||
|
||
//模块 | ||
@import "topBar"; | ||
@import "nav"; | ||
@import "tabs"; |
Oops, something went wrong.