You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
14
static/plugins/slide/css/slide.css
Executable file
14
static/plugins/slide/css/slide.css
Executable file
@ -0,0 +1,14 @@
|
||||
img { border: 0;}
|
||||
.ck-slide ul { margin: 0; padding: 0; list-style-type: none;}
|
||||
.ck-slide { position: relative; overflow: hidden;}
|
||||
.ck-slide ul.ck-slide-wrapper { position: absolute; top: 0; left: 0; z-index: 1; margin: 0; padding: 0;}
|
||||
.ck-slide ul.ck-slide-wrapper li { position: absolute;}
|
||||
.ck-slide .ck-prev, .ck-slide .ck-next { position: absolute; top: 50%; z-index: 2; width: 35px; height: 70px; margin-top: -35px; border-radius: 3px; opacity: .15; background: red; text-indent: -9999px; background-repeat: no-repeat; transition: opacity .2s linear 0s;}
|
||||
.ck-slide .ck-prev { left: 5px; background: url(../images/arrow-left.png) #000 50% no-repeat;}
|
||||
.ck-slide .ck-next { right: 5px; background: url(../images/arrow-right.png) #000 50% no-repeat;}
|
||||
.ck-slidebox { position: absolute; left: 50%; bottom: 12px; z-index: 30;}
|
||||
.ck-slidebox ul { height: 20px; padding: 0 4px; border-radius: 8px; background: rgba(0,0,0,0.5);}
|
||||
.ck-slidebox ul li { float: left; height: 12px; margin: 4px 4px;}
|
||||
.ck-slidebox ul li em { display: block; width: 12px; height: 12px; border-radius: 100%; background-color: #fff; text-indent: -9999px; cursor: pointer;}
|
||||
.ck-slidebox ul li.current em { background-color: #fe6500;}
|
||||
.ck-slidebox ul li em:hover { background-color: #fe6500;}
|
BIN
static/plugins/slide/images/arrow-left.png
Executable file
BIN
static/plugins/slide/images/arrow-left.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
BIN
static/plugins/slide/images/arrow-right.png
Executable file
BIN
static/plugins/slide/images/arrow-right.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
117
static/plugins/slide/js/slide.js
Executable file
117
static/plugins/slide/js/slide.js
Executable file
@ -0,0 +1,117 @@
|
||||
(function($){
|
||||
$.fn.ckSlide = function(opts){
|
||||
opts = $.extend({}, $.fn.ckSlide.opts, opts);
|
||||
this.each(function(){
|
||||
var slidewrap = $(this).find('.ck-slide-wrapper');
|
||||
var slide = slidewrap.find('li');
|
||||
var count = slide.length;
|
||||
var that = this;
|
||||
var index = 0;
|
||||
var time = null;
|
||||
$(this).data('opts', opts);
|
||||
// next
|
||||
$(this).find('.ck-next').on('click', function(){
|
||||
if(opts['isAnimate'] == true){
|
||||
return;
|
||||
}
|
||||
|
||||
var old = index;
|
||||
if(index >= count - 1){
|
||||
index = 0;
|
||||
}else{
|
||||
index++;
|
||||
}
|
||||
change.call(that, index, old);
|
||||
});
|
||||
// prev
|
||||
$(this).find('.ck-prev').on('click', function(){
|
||||
if(opts['isAnimate'] == true){
|
||||
return;
|
||||
}
|
||||
|
||||
var old = index;
|
||||
if(index <= 0){
|
||||
index = count - 1;
|
||||
}else{
|
||||
index--;
|
||||
}
|
||||
change.call(that, index, old);
|
||||
});
|
||||
$(this).find('.ck-slidebox li').each(function(cindex){
|
||||
$(this).on('click.slidebox', function(){
|
||||
change.call(that, cindex, index);
|
||||
index = cindex;
|
||||
});
|
||||
});
|
||||
|
||||
// focus clean auto play
|
||||
$(this).on('mouseover', function(){
|
||||
if(opts.autoPlay){
|
||||
clearInterval(time);
|
||||
}
|
||||
$(this).find('.ctrl-slide').css({opacity:0.6});
|
||||
});
|
||||
// leave
|
||||
$(this).on('mouseleave', function(){
|
||||
if(opts.autoPlay){
|
||||
startAtuoPlay();
|
||||
}
|
||||
$(this).find('.ctrl-slide').css({opacity:0.15});
|
||||
});
|
||||
startAtuoPlay();
|
||||
// auto play
|
||||
function startAtuoPlay(){
|
||||
if(opts.autoPlay){
|
||||
time = setInterval(function(){
|
||||
var old = index;
|
||||
if(index >= count - 1){
|
||||
index = 0;
|
||||
}else{
|
||||
index++;
|
||||
}
|
||||
change.call(that, index, old);
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
// 修正box
|
||||
var box = $(this).find('.ck-slidebox');
|
||||
box.css({
|
||||
'margin-left':-(box.width() / 2)
|
||||
})
|
||||
// dir
|
||||
switch(opts.dir){
|
||||
case "x":
|
||||
opts['width'] = $(this).width();
|
||||
slidewrap.css({
|
||||
'width':count * opts['width']
|
||||
});
|
||||
slide.css({
|
||||
'float':'left',
|
||||
'position':'relative'
|
||||
});
|
||||
slidewrap.wrap('<div class="ck-slide-dir"></div>');
|
||||
slide.show();
|
||||
break;
|
||||
}
|
||||
});
|
||||
};
|
||||
function change(show, hide){
|
||||
var opts = $(this).data('opts');
|
||||
if(opts.dir == 'x'){
|
||||
var x = show * opts['width'];
|
||||
$(this).find('.ck-slide-wrapper').stop().animate({'margin-left':-x}, function(){opts['isAnimate'] = false;});
|
||||
opts['isAnimate'] = true
|
||||
}else{
|
||||
$(this).find('.ck-slide-wrapper li').eq(hide).stop().animate({opacity:0});
|
||||
$(this).find('.ck-slide-wrapper li').eq(show).show().css({opacity:0}).stop().animate({opacity:1});
|
||||
}
|
||||
|
||||
$(this).find('.ck-slidebox li').removeClass('current');
|
||||
$(this).find('.ck-slidebox li').eq(show).addClass('current');
|
||||
}
|
||||
$.fn.ckSlide.opts = {
|
||||
autoPlay: false,
|
||||
dir: null,
|
||||
isAnimate: false
|
||||
};
|
||||
})(jQuery);
|
1
static/plugins/slide/js/slide.min.js
vendored
Executable file
1
static/plugins/slide/js/slide.min.js
vendored
Executable file
@ -0,0 +1 @@
|
||||
(function($){$.fn.ckSlide=function(opts){opts=$.extend({},$.fn.ckSlide.opts,opts);this.each(function(){var slidewrap=$(this).find('.ck-slide-wrapper');var slide=slidewrap.find('li');var count=slide.length;var that=this;var index=0;var time=null;$(this).data('opts',opts);$(this).find('.ck-next').on('click',function(){if(opts['isAnimate']==true){return;}var old=index;if(index>=count-1){index=0;}else{index++;}change.call(that,index,old);});$(this).find('.ck-prev').on('click',function(){if(opts['isAnimate']==true){return;}var old=index;if(index<=0){index=count-1;}else{index--;}change.call(that,index,old);});$(this).find('.ck-slidebox li').each(function(cindex){$(this).on('click.slidebox',function(){change.call(that,cindex,index);index=cindex;});});$(this).on('mouseover',function(){if(opts.autoPlay){clearInterval(time);}$(this).find('.ctrl-slide').css({opacity:0.6});});$(this).on('mouseleave',function(){if(opts.autoPlay){startAtuoPlay();}$(this).find('.ctrl-slide').css({opacity:0.15});});startAtuoPlay();function startAtuoPlay(){if(opts.autoPlay){time=setInterval(function(){var old=index;if(index>=count-1){index=0;}else{index++;}change.call(that,index,old);},2000);}}var box=$(this).find('.ck-slidebox');box.css({'margin-left':-(box.width()/2)})switch(opts.dir){case "x":opts['width']=$(this).width();slidewrap.css({'width':count*opts['width']});slide.css({'float':'left','position':'relative'});slidewrap.wrap('<div class="ck-slide-dir"></div>');slide.show();break;}});};function change(show,hide){var opts=$(this).data('opts');if(opts.dir=='x'){var x=show*opts['width'];$(this).find('.ck-slide-wrapper').stop().animate({'margin-left':-x},function(){opts['isAnimate']=false;});opts['isAnimate']=true}else{$(this).find('.ck-slide-wrapper li').eq(hide).stop().animate({opacity:0});$(this).find('.ck-slide-wrapper li').eq(show).show().css({opacity:0}).stop().animate({opacity:1});}$(this).find('.ck-slidebox li').removeClass('current');$(this).find('.ck-slidebox li').eq(show).addClass('current');}$.fn.ckSlide.opts={autoPlay:false,dir:null,isAnimate:false};})(jQuery);
|
Reference in New Issue
Block a user