how do i change image width in jCarousel?

让人想犯罪 __ 提交于 2019-12-11 23:55:57

问题


http://sorgalla.com/projects/jcarousel/

Above is the carousel application i'm using (one of the more popular open source ones at the moment) and I can't figure out how to change the default image width as I have a dozen or so pictures that all have a pixel width of 170px and yet the current setting seems to be set at around 80px which makes all of the images overlap, how do i change this? Is there a way to add some margin in as well? I tried changing the css in jcarousel/skins/tango/skin.css but apparently, even when I delete everything in that css file, nothing gets affected on the carousel page - when I remove the link the carousel stops functioning and turns into a wide div with static images, which is very odd to me.


回答1:


That carousel uses <img> tags which means you'd either have to specify each width in the markup like this:

<img src="..." height="..." width="170" />

or use the img selector in the CSS file, something like this:

.jcarousel-skin-tango .jcarousel-item-horizontal img {
    width: 170px;
}

Either way, you'd also have to make the carousel container wide enough to accommodate its contents. You can give the containing ul some large width (the excess would be hidden anyway), like:

ul#carousel {
   width: 99999px;
}

The carousel would stop at the last image anyway, but at least you'd know you have more than enough room to accommodate however many pictures you have and prevent the overlapping.



来源:https://stackoverflow.com/questions/7245595/how-do-i-change-image-width-in-jcarousel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!