简体   繁体   English

jQuery旋转木马滑块

[英]jQuery Carousel Slider

I'm using the simple.carousel.js for a simple small slider, where there is an image and some text. 我将simple.carousel.js用于一个简单的小滑块,其中有图像和一些文本。 As you may know, this plugin uses the <ul> tag to slide the <li> elements. 如您所知,此插件使用<ul>标记滑动<li>元素。 You can set the width and height of the carouselslider in javascript like 您可以在javascript中设置轮播滑块的宽度和高度,例如

> $("ul.homecarouselslider").simplecarousel({
>     height:200,
>     width:160,
>     visible: 1,
>     auto: 25000,
>     next: $('.offerright'),
>     prev: $('.offerleft') });

If you dont set those dimensions in javascript, the .js file has default sizes to set. 如果未在javascript中设置这些尺寸,则.js文件具有要设置的默认尺寸。 But i want this plugin to have different dimensions for each <li> element, because there is a larger image in it, or bigger text. 但我希望此插件的每个<li>元素具有不同的尺寸,因为其中有较大的图像或较大的文本。 If you exceed this height because the text has 250px height instead of 200px which is the limit for the slider, it doesnt display it. 如果您超过此高度,因为文本的高度为250px而不是滑块的限制200px,则它不会显示。 Any ideas how in this slider, the <li> elements can get the dimensions of the inner divs? 任何想法如何在此滑块中, <li>元素如何获取内部div的尺寸? Thank you in advance :) 先感谢您 :)

PS. PS。 The html code is something like this: html代码是这样的:

<div id="offers">   
    <ul id="homecarouselslider" class="homecarouselslider" style="list-style-type:none;overflow:hidden;width:600px;height:190px;">    
         <li style="float:left;width:160px;height:190px;">
           <div id="offer1">
            <div id="offertitle"><?php echo $row['title']; ?></div>
            <img id="offerimg" src="<?php echo $row['picture1']; ?>">
                <div id="offerdesc">
                <div id="offerdesctext"><?php  echo $row['full_description']; ?>  </div>
                  <div  class="offerleft" id="offerleft"><img src="images/offerleft.png"> </div>
                  <div  class="offerleft" id="offerright"><img src="images/offerright.png"></div>   
                  <div id="offerbook">BOOK NOW</div>    
                        </div>  
                        </div>  
        </li>
    </ul>
</div>

Why won't you use a maximum height for the carousel? 您为什么不为转盘使用最大高度? The maximum height of a li element. li元素的最大高度。 Because I'm assuming that there is content under the carousel, and if you would implement it as you say, the content at bottom of the carousel would 'bounce' when you hva different heights. 因为我假设轮播下有内容,并且如果按照您说的去实现,那么当您身高不同时,轮播底部的内容会“反弹”。

If you still want that behavior, I recomand you to see if there is an overflow:hidden set to ul element, that I thinks that i set by carousel.js, and change it in your css file with overflow:visible !important . 如果您仍然想要这种行为,我建议您查看是否有将UL overflow:hidden设置为ul元素,我认为我是由carousel.js设置的,并使用overflow:visible !important在您的css文件中对其进行了更改。

Just remove the overflow:hidden for slider and use a bigger image. 只需删除overflow:hiddenslider并使用更大的图像即可。

Updated fiddle 更新的小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM