在這裏你去。 添加一個內部的div,如:
<div class="slide1">
<div class="slide-inner">
......
</div>
</div>
CSS:
.slide-inner {
left: 0;
position: absolute;
width: 100%;
}
.slide1 {
overflow: hidden;
position: relative;
}
的jQuery:
jQuery(document).ready(function(){
var totalWidth = 0;
var select = jQuery('.slide1').find('.slide-inner > div');
select.each(function(index) {
totalWidth = +(totalWidth)+(+$(this).outerWidth(true));
});
jQuery('.slide-inner').width(totalWidth);
$('.next').click(function(){
var currentSlide=$('.active-slide');
var nextSlide=currentSlide.next();
//currentSlide.removeClass('active-slide');
//nextSlide.addClass('active-slide');
// .position() uses position relative to the offset parent,
var pos = nextSlide.position();
// .outerWidth() takes into account border and padding.
var width = nextSlide.outerWidth();
//show the menu directly over the placeholder
jQuery('.slide-inner').animate({"left":(pos.left + width) + "px"}, "slow");
});
});
向我們展示你的HTML和樣式 – 2014-11-04 20:52:32
你想要的圖像與淡出滑動或者只是移動一個大的div內的項目? – Demodave 2014-11-04 20:55:19
[鏈接] http://sorfilm.byethost8.com/瞭解更多信息我附上鍊接頁面。在一個大的div內移動項目,但有2種不同的佈局。 – 2014-11-04 21:14:16