這是我現在使用滑塊的代碼:從AnythingSlider V1.2遷移到最新版本(v1.8.17)
JAVASCRIPT
function formatText(index, panel) {
return index + "";
$(function() {
$('.anythingSlider').anythingSlider({
easing: "easeInOutExpo", // Anything other than "linear" or "swing" requires the easing plugin
autoPlay: true, // This turns off the entire FUNCTIONALY, not just if it starts running or not.
delay: 5000, // How long between slide transitions in AutoPlay mode
startStopped: false, // If autoPlay is on, this can force it to start stopped
animationTime: 600, // How long the slide transition takes
hashTags: true, // Should links change the hashtag in the URL?
buildNavigation: false, // If true, builds and list of anchor links to link to each slide
pauseOnHover: true, // If true, and autoPlay is enabled, the show will pause on hover
startText: "Go", // Start text
stopText: "Stop", // Stop text
navigationFormatter: formatText // Details at the top of the file on this use (advanced use)
});
$("#slide-jump").click(function(){
$('.anythingSlider').anythingSlider(5);
});
});
HTML
<div class="anythingSlider">
<div class="wrapper">
<ul>
<li>
<p><img alt="" width="582" height="255" src="IMAGELINK"></p>
<div class="container"><a href="LINK" class="info">TEXT</a></div>
</li>
<li>
<p><img alt="" width="582" height="255" src="IMAGELINK"></p>
<div class="container"><a href="LINK" class="info">TEXT</a></div>
</li>
</ul>
</div>
</div>
這是它在JSFiddle上工作:http://jsfiddle.net/LUEwg/1/
正如你可以看到它使用jQuery(1.9.1),AnythingSlider(v1.2)和Easing插件(來自「外部資源」)。 我想遷移到最新的AnythingSlider版本,即v.1.8.17。
問題是我的代碼需要一些更改,因爲它與AnythingSlider 1.8.17不兼容。
在這裏,您可以看到新老版本之間的差異: http://diffchecker.com/3zadzbvc
謝謝!!它完美的作品。 :)出於好奇,需要附加到文件名的#&panel1-2?有沒有辦法避免這種情況? – MultiformeIngegno
將['hashTags'選項](https://github.com/CSS-Tricks/AnythingSlider/wiki/Navigation-options#hashtags-true)設置爲'false'。你可以在這裏找到[完整的文檔](https://github.com/CSS-Tricks/AnythingSlider/wiki) – Mottie