Fix bug.
This commit is contained in:
parent
8190d52131
commit
9f885a05eb
|
@ -175,7 +175,8 @@
|
||||||
var carousel_images_slide = $('.carousel_images_slide');
|
var carousel_images_slide = $('.carousel_images_slide');
|
||||||
var carousel_images_slide_first_child = carousel_images_slide.find(">li").eq(active_slide);
|
var carousel_images_slide_first_child = carousel_images_slide.find(">li").eq(active_slide);
|
||||||
if(carousel_images_slide_first_child.length > 0){
|
if(carousel_images_slide_first_child.length > 0){
|
||||||
var content_size = Math.floor(carousel_images_slide.width() / carousel_images_slide_first_child.width());
|
var content_size = Math.floor((carousel_images_slide.width() - Number.parseInt(carousel_images_slide.css('font-size')) * 3) / carousel_images_slide_first_child.width());
|
||||||
|
content_size = Math.max(content_size,1);
|
||||||
if(carousel_images_slide.find(">li").length > content_size && active_slide > 0){
|
if(carousel_images_slide.find(">li").length > content_size && active_slide > 0){
|
||||||
active_slide -= content_size;
|
active_slide -= content_size;
|
||||||
carousel_images_slide.find(">li").css("display","none");
|
carousel_images_slide.find(">li").css("display","none");
|
||||||
|
@ -189,9 +190,12 @@
|
||||||
var carousel_images_slide = $('.carousel_images_slide');
|
var carousel_images_slide = $('.carousel_images_slide');
|
||||||
var carousel_images_slide_first_child = carousel_images_slide.find(">li").eq(active_slide);
|
var carousel_images_slide_first_child = carousel_images_slide.find(">li").eq(active_slide);
|
||||||
if(carousel_images_slide_first_child.length > 0){
|
if(carousel_images_slide_first_child.length > 0){
|
||||||
var content_size = Math.floor(carousel_images_slide.width() / carousel_images_slide_first_child.width());
|
var content_size = Math.floor((carousel_images_slide.width() - Number.parseInt(carousel_images_slide.css('font-size')) * 3) / carousel_images_slide_first_child.width());
|
||||||
if(carousel_images_slide.find(">li").length > content_size && (active_slide < carousel_images_slide.find(">li").length - 1)){
|
content_size = Math.max(content_size,1);
|
||||||
|
var li_length = carousel_images_slide.find(">li").length;
|
||||||
|
if(li_length > content_size && (active_slide < li_length - 1)){
|
||||||
active_slide += content_size;
|
active_slide += content_size;
|
||||||
|
active_slide = Math.min(active_slide,li_length - 1);
|
||||||
carousel_images_slide.find(">li").css("display","none");
|
carousel_images_slide.find(">li").css("display","none");
|
||||||
for(var i = active_slide; i < active_slide + content_size;i++){
|
for(var i = active_slide; i < active_slide + content_size;i++){
|
||||||
carousel_images_slide.find(">li").eq(i).css("display","block");
|
carousel_images_slide.find(">li").eq(i).css("display","block");
|
||||||
|
@ -222,12 +226,15 @@
|
||||||
var carousel_images_slide = $('.carousel_images_slide');
|
var carousel_images_slide = $('.carousel_images_slide');
|
||||||
var carousel_images_slide_first_child = carousel_images_slide.find(">li").eq(active_slide);
|
var carousel_images_slide_first_child = carousel_images_slide.find(">li").eq(active_slide);
|
||||||
if(carousel_images_slide_first_child.length > 0){
|
if(carousel_images_slide_first_child.length > 0){
|
||||||
var content_size = Math.floor(carousel_images_slide.width() / carousel_images_slide_first_child.width());
|
var content_size = Math.floor((carousel_images_slide.width() - Number.parseInt(carousel_images_slide.css('font-size')) * 3) / carousel_images_slide_first_child.width());
|
||||||
|
content_size = Math.max(content_size,1);
|
||||||
carousel_images_slide.find(">li").css("display","none");
|
carousel_images_slide.find(">li").css("display","none");
|
||||||
var active_count = carousel_images_slide.find(">li").length - active_slide;
|
var active_count = carousel_images_slide.find(">li").length - active_slide;
|
||||||
if(active_count < content_size){
|
if(active_count < content_size){
|
||||||
active_slide -= (content_size - active_count);
|
active_slide -= (content_size - active_count);
|
||||||
}
|
}
|
||||||
|
active_slide = Math.max(active_slide,0);
|
||||||
|
console.log(content_size)
|
||||||
for(var i = active_slide; i < active_slide + content_size;i++){
|
for(var i = active_slide; i < active_slide + content_size;i++){
|
||||||
carousel_images_slide.find(">li").eq(i).css("display","block");
|
carousel_images_slide.find(">li").eq(i).css("display","block");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue