This commit is contained in:
BoHung Chiu 2021-04-11 12:42:32 +08:00
parent 88eec58422
commit 4c2deb4796
1 changed files with 13 additions and 1 deletions

View File

@ -193,7 +193,7 @@
var content_size = Math.floor((carousel_images_slide.width() - Number.parseInt(carousel_images_slide.css('font-size')) * 3) / 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); content_size = Math.max(content_size,1);
var li_length = carousel_images_slide.find(">li").length; var li_length = carousel_images_slide.find(">li").length;
if(li_length > content_size && (active_slide < li_length - 1)){ if(li_length > content_size){
active_slide += content_size; active_slide += content_size;
active_slide = Math.min(active_slide,li_length - 1); 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");
@ -222,6 +222,18 @@
$(".active_slide").text($('.bulletin_carousel_slide.cycle-slide-active').index()); $(".active_slide").text($('.bulletin_carousel_slide.cycle-slide-active').index());
}) })
}) })
$(window).on("load",function(){
$(".carousel_images .cycle-slideshow").cycle('pause');
var carousel_image_block_width = $('.carousel_images').width();
var heights = $(".bulletin_carousel_slide").map(function(i,v){
return $(v).height() * carousel_image_block_width / $(v).width();
})
var max_height = Math.max.apply(null,heights);
$(".bulletin_carousel_slide").each(function(i,v){
$(v).height(max_height);
})
$(".carousel_images .cycle-slideshow").cycle('resume');
})
$(window).resize(function(){ $(window).resize(function(){
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);