使用方法
(function() {
var rotateSlider;
$(function() {
$('#nav').on('click', 'a', function(e) {
var active, theSlide;
e = e != null ? e : {
e: window.event
};
e.preventDefault();
e.stopPropagation();
if ($('#nav').hasClass('active')) {
return false;
}
$('.focus').removeClass('focus');
$(this).addClass('focus');
$('#nav').addClass('active');
theSlide = $(this).attr('data-slide');
active = $('.active').attr('data-slide');
$('.slide').removeClass('active');
return rotateSlider(theSlide, active);
});
//DEMO
setTimeout(function() {
return $('#nav a[data-slide="2"]').trigger('click');
}, 500);
setTimeout(function() {
return $('#nav a[data-slide="3"]').trigger('click');
}, 1200);
return setTimeout(function() {
return $('#nav a[data-slide="4"]').trigger('click');
}, 1900);
});
rotateSlider = function(slide, active) {
/*
TODO -
detect current slide position and calculate no. slides to
target. Ease through those slides to avoid CSS3
transition wonkiness.
*/
var delta, slides, theSlide;
slides = {
1: 'one',
2: 'two',
3: 'three',
4: 'four'
};
theSlide = slides[slide];
delta = Math.abs(slide - active);
if (delta === 3 && active === '1') {
$('.slide[data-slide="' + slide + '"]').addClass('active');
$('.slider-inner').attr('class', 'slider-inner rotate two');
setTimeout(function() {
return $('.slider-inner').attr('class', 'slider-inner rotate three');
}, 400);
setTimeout(function() {
return $('.slider-inner').attr('class', 'slider-inner rotate four');
}, 800);
} else if (delta === 3 && active === '4') {
$('.slide[data-slide="' + slide + '"]').addClass('active');
$('.slider-inner').attr('class', 'slider-inner rotate three');
setTimeout(function() {
return $('.slider-inner').attr('class', 'slider-inner rotate two');
}, 350);
setTimeout(function() {
return $('.slider-inner').attr('class', 'slider-inner rotate one');
}, 700);
} else {
$('.slide[data-slide="' + slide + '"]').addClass('active');
$('.slider-inner').attr('class', 'slider-inner rotate ' + theSlide);
}
return $('#nav').removeClass('active');
};
}).call(this);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiPGFub255bW91cz4iXSwibmFtZXMiOltdLCJtYXB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c2xpZGVyLWlubmVyJykuYXR0ciAnY2xhc3MnLCAnc2xpZGVyLWlubmVyIHJvdGF0ZSB0d28nXG4gICAgLCAzNTBcbiAgICBzZXRUaW1lb3V0ICgpLT5cbiAgICAgICQoJy5zbGlkZXItaW5uZXInKS5hdHRyICdjbGFzcycsICdzbGlkZXItaW5uZXIgcm90YXRlIG9uZSdcbiAgICAsIDcwMFxuICAgIFxuICAgIFxuICBlbHNlXG4gICAgJCgnLnNsaWRlW2RhdGEtc2xpZGU9XCInK3NsaWRlKydcIl0nKS5hZGRDbGFzcygnYWN0aXZlJylcbiAgICAkKCcuc2xpZGVyLWlubmVyJykuYXR0ciAnY2xhc3MnLCAnc2xpZGVyLWlubmVyIHJvdGF0ZSAnK3RoZVNsaWRlXG4gIFxuICBcbiAgJCgnI25hdicpLnJlbW92ZUNsYXNzKCdhY3RpdmUnKVxuICAiXX0=
//# sourceURL=coffeescript
站长提示:
1. 苦力吧素材官方QQ群:
950875342
2. 平台上所有素材资源,需注册登录会员方能正常下载。
3. 会员用户积极反馈网站、素材资源BUG或错误问题,每次奖励
2K币。
4. PHP源码类素材,如需协助安装调试,或你有二次开发需求,可联系苦力吧客服。
5. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服