您可以將一個HTML這樣的:
<div class="main_view">
<div class="window">
<div class="image_reel">
<a href="#">
<img width="948" src="Images/Home/LIV.jpg" alt=""></a> <a href="#">
<img width="948" src="Images/Home/JUM.jpg" alt=""></a> <a href="#">
<img width="948" src="Images/Home/LOV.jpg" alt=""></a> <a href="#">
<img width="948" src="Images/Home/BLI.jpg" alt=""></a>
</div>
<div class="pictureslide">
<h2>
Livestrong</h2>
<p>
Mobile donations to fight cancer and improve lives.</p>
<a href="http://thirteen23.com/work/#livestrong-donation">See more</a>
</div>
<div class="pictureslide">
<h2>
Jumpshot</h2>
<p>
The lighter side of serious software.</p>
<a href="/#jumpshot">See more</a>
</div>
<div class="pictureslide">
<h2>
Flashback</h2>
<p>
An exciting way to explore, stylize, and share your Facebook photos.</p>
<a href="/#flashback">See more</a>
</div>
<div class="pictureslide">
<h2>
Love Universe</h2>
<p>
Blurring the line between product and lifestyle.</p>
<a href="/#love-universe">See more</a>
</div>
</div>
<div class="paging">
<a href="#" rel="1">
<img src="Images/Home/LIV_sm.jpg" alt=""></a> <a href="#" rel="2">
<img src="Images/Home/JUM_sm.jpg" alt=""></a> <a href="#" rel="3">
<img src="Images/Home/LOV_sm.jpg" alt=""></a> <a href="#" rel="4">
<img src="Images/Home/BLI_sm.jpg" alt=""></a>
</div>
</div>
那麼你的JS:
var MainPageSlider = function (windowObj,element) {
var parent = $("#"+element);//element is the ID of the Master/Parent of this HTMLCode
parent.data('imagewidth', windowObj.imageWidth);
parent.data('imageSum', windowObj.imagesum + 1);
$(".paging a:first", parent).addClass("active");
var intervalCulture;
var imageReelWidth = parent.data('imagewidth') * parent.data('imageSum');
$(".image_reel", parent).css({ 'width': imageReelWidth });
rotate = function() {
var triggerID = $active.attr("rel") - 1;
var image_reelPosition = triggerID * (parent.data('imagewidth') + 30);
$(".paging a", parent).removeClass('active');
$active.addClass('active');
$(".image_reel", parent).animate({
left: -image_reelPosition
}, 500);
};
rotateSwitch = function() {
play = setInterval(function() {
$active = $('.paging a.active', parent).next();
if ($active.length === 0) {
$active = $('.paging a:first', parent);
}
rotate();
}, 7000);
};
rotateSwitch();
$(".image_reel a", parent).hover(function() {
clearInterval(play);
}, function() {
rotateSwitch();
});
$(".paging a", parent).click(function() {
$active = $(this);
clearInterval(play);
rotate();
rotateSwitch();
return false;
});
};
MainPageSlider(windowObj,'element');//element is the Parent of this HTML
,然後添加適當的樣式代碼。 另外,根據需要編寫懸停功能。
謝謝!我沒有找到我想要的東西,但我發現Orbit在我的HTML文件中看起來很棒。 –