我正在使用jQuery滑塊。目前有兩個圖像,第一個圖像的位置不正確。jQuery滑塊上的第一個圖像不合適
下面是我從工作的網址:http://www.ayrturfandtrac.org/
這是在頁面的左下方。
我想在與第二個圖像相同的位置放置第一個圖像(居中在按鈕之間)。
這裏是我的代碼:
HTML:
<div id="fader">
<img src="http://www.ayrturfandtrac.org/wp-content/uploads/2012/11/usedListing.png" class="usedListingImage">
<img src="http://www.ayrturfandtrac.org/wp-content/uploads/2012/12/kubotaB2320.png" class="usedListingImage">
</div>
<div id="next">
<img id="nextListing" class="nextListing" src="http://www.ayrturfandtrac.org/wp-content/uploads/2012/12/nextListingArrow.png" onmouseover="this.src='http://www.ayrturfandtrac.org/wp-content/uploads/2012/12/nextListingHover.png'" onmouseout="this.src='http://www.ayrturfandtrac.org/wp-content/uploads/2012/12/nextListingArrow.png'">
</div>
的jQuery:
<script type="text/javascript">
jQuery (function() {
$('#fader img:not(:first)').hide();
$('#fader img').each(function() {
var img = $(this);
$('<img>').attr('src', $(this).attr('src')).load(function() {
img.css('margin-left', -this.width/2 + 'px');
});
});
var pause = false;
function fadeNext() {
$('#fader img').first().fadeOut().appendTo($('#fader'));
$('#fader img').first().fadeIn();
}
function fadePrev() {
$('#fader img').first().fadeOut();
$('#fader img').last().prependTo($('#fader')).fadeIn();
}
$('#fader, #next').click(function() {
fadeNext();
});
$('#prev').click(function() {
fadePrev();
});
$('#fader, .button').hover(function() {
pause = true;
},function() {
pause = false;
});
function doRotate() {
if(!pause) {
fadeNext();
}
}
var rotate = setInterval(doRotate, 5000);
});
</script>
請包括您的CSS,請爲此滑塊 – dmi3y
.nextListing {width:5%; float:right; margin:6%5%5%5%; padding-right:5%;} .prevListing {width:5%; float:left;保證金:7%5%5%5%; } .used {float:left; width:50%;} .usedListingImage {width:65%; float:left;顯示:塊; margin:-1%auto 0 auto;} #fader {display:block;保證金左:50%;寬度:95%} –
重新設計完整的圖庫結構或使用收件箱 – dmi3y