2012-03-09 81 views
0

我一直在爲此而苦苦掙扎,它讓我把頭髮拉出來!如何暫停這個jquery滑塊?

http://webdesignsalemoregon.com/westernmennoniteschool/

我有了這個主頁上滑塊和我試圖找出如何添加一個「點擊暫停」功能吧。 (也許點擊恢復過,哈哈)

我相信這是代碼生成滑塊

var $featured_content = jQuery('#featured #slides'), 
    et_featured_slider_auto = jQuery("meta[name=et_featured_slider_auto]").attr('content'), 
    et_featured_auto_speed = jQuery("meta[name=et_featured_auto_speed]").attr('content'); 

if ($featured_content.length){ 
    var et_featured_options = { 
     timeout: 2000, 
     speed: 500, 
     cleartypeNoBg: true, 
     prev: '#featured a#featured-left', 
     next: '#featured a#featured-right', 
     pager: '#controllers', 
    } 
    if (et_featured_slider_auto == 1) et_featured_options.timeout = et_featured_auto_speed; 

    $featured_content.cycle(et_featured_options); 
} 

然後我添加了一個簡單的按鈕與ID =「暫停按鈕」,並把它上面的滑塊。我也得到了這個按鈕的代碼

$('#pauseButton').click(function() { 
$featured_content.cycle('pause'); 
}); 

但它實際上並沒有暫停幻燈片?我相信這是一個使用週期插件從http://jquery.malsup.com/cycle/我從http://jquery.malsup.com/cycle/pause.html

拉暫停代碼我要去哪裏錯了?

回答

1

你的腳本使用jQuery.noConflict(),引起$變量將恢復到它是什麼被列入jQuery的面前。嘗試用jQuery()代替$()的所有發生。

jQuery('#pauseButton').click(function() { 
    $featured_content.cycle('pause'); 
}); 
+0

哇,我會給你一個很大的溼吻,如果我可以! 你是一個拯救生命的人:) – Xhynk 2012-03-09 19:09:02