|
|
var $ = require("yoho-jquery"),
|
|
|
IScroll = require("yoho-iscroll"),
|
|
|
var $ = require('yoho-jquery'),
|
|
|
IScroll = require('yoho-iscroll'),
|
|
|
lazyLoad = require('yoho-jquery-lazyload'),
|
|
|
Countdown = require('./countdown').Countdown;
|
|
|
|
|
|
lazyLoad($('img.lazy'));
|
|
|
|
|
|
// nav 滚动
|
|
|
function initNavScroll() {
|
|
|
var $navBox = $(".outlet-nav"),
|
|
|
$lis = $navBox.find("li"),
|
|
|
var $navBox = $('.outlet-nav'),
|
|
|
$lis = $navBox.find('li'),
|
|
|
iScroll;
|
|
|
|
|
|
iScroll = new IScroll($navBox[0], {
|
|
|
scrollX: true,
|
|
|
scrollY: false,
|
|
|
scrollY: false
|
|
|
});
|
|
|
$navBox.on("click", "li", function() {
|
|
|
$navBox.on('click', 'li', function() {
|
|
|
var $this = $(this);
|
|
|
var i = $this.index();
|
|
|
$lis.eq(i).addClass("active").siblings().removeClass("active");
|
|
|
$lis.eq(i).addClass('active').siblings().removeClass('active');
|
|
|
scroll($this[0]);
|
|
|
});
|
|
|
|
|
|
function scroll(ele) {
|
|
|
var offset = -($navBox.find("ul").width() - 20) / 2;
|
|
|
var offset = -($navBox.find('ul').width() - 20) / 2;
|
|
|
setTimeout(function() {
|
|
|
iScroll.scrollToElement(ele, 400, offset)
|
|
|
iScroll.scrollToElement(ele, 400, offset);
|
|
|
}, 1);
|
|
|
}
|
|
|
//scroll($navBox.find(".active")[0]);
|
|
|
|
|
|
// scroll($navBox.find(".active")[0]);
|
|
|
}
|
|
|
|
|
|
function initCountDown(){
|
|
|
$('#demo1 .cd').each(function(index,node) {
|
|
|
function initCountDown() {
|
|
|
$('#demo1 .cd').each(function(index, node) {
|
|
|
Countdown({
|
|
|
el: node,
|
|
|
callback:function(){
|
|
|
alert(1)
|
|
|
callback: function() {
|
|
|
alert(1);
|
|
|
}
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -42,7 +46,7 @@ function initCountDown(){ |
|
|
el: '#demo4 .cd'
|
|
|
});
|
|
|
cd.notify(0, function() {
|
|
|
alert(1)
|
|
|
alert(1);
|
|
|
});
|
|
|
|
|
|
Countdown({
|
...
|
...
|
@@ -53,4 +57,4 @@ function initCountDown(){ |
|
|
}
|
|
|
|
|
|
initNavScroll();
|
|
|
initCountDown(); |
|
|
\ No newline at end of file |
|
|
initCountDown(); |
...
|
...
|
|