2013-03-05 53 views
0

我使用EasyTabs(http://os.alfajango.com/easytabs)來構建我的網站。我想添加一個滑塊腳本以在最初不可見的其中一個選項卡中進行操作。當選項卡被選中時,滑塊腳本不會被激活。EasyTabs +滑塊腳本 - 滑塊不會初始化

<html> 
<head> 
    <script src="http://code.jquery.com/jquery-latest.min.js"></script> 
    <script src="js/jquery.ba-hashchange.js" type="text/javascript"></script> 
    <script src="js/jquery.easytabs.js" type="text/javascript"></script> 
    <script src="js/jquery.slides.min.js"></script> 

這將啓動EasyTabs腳本:

<script type="text/javascript"> 
$(document).ready(function() { 
    $('#tab-container').easytabs(); 
}); 
</script> 

這將啓動滑塊腳本:

<script> 
$(function() { 
    $('#slides').slidesjs({ 
    width: 1000, 
    height: 444, 
    navigation: false, 
    play: { 
     interval: 2000, 
     auto: true 
    } 
    }); 
}); 
</script> 

所有這一切都在標題中。

</head> 

如何在包含它的EasyTabs選項卡上單擊時初始化該Slider腳本?謝謝!

+0

推薦後您使用瀏覽器的開發者工具,看看什麼樣的腳本錯誤的你越來越... – 2013-03-05 15:47:53

+0

我沒有收到任何我可以看到的錯誤,也許這會有所幫助: 這是包含Slider的標籤的直接鏈接: http://www.kcchartaire.com/v4/aboutus.html#tabs1-slide 正如你所看到的,如果你直接鏈接到該選項卡,它就可以工作。 但用戶將隱藏滑塊選項卡到達初始頁面。一旦你點擊Slider標籤(最後一個),你將看到幻燈片不顯示: http://www.kcchartaire.com/v4/aboutus.html – 2013-03-10 01:15:25

回答

0

我得到了與Bootstrap框架和我的圖像滑塊相同的問題,滑塊加載它的腳本之前該選項卡和其內容是活動的,導致一個不太工作的滑塊。是否有一個類似的事件處理程序來加載腳本,就像標籤打開一樣?

<script src="https://code.jquery.com/jquery-1.12.3.min.js" integrity="sha256-aaODHAgvwQW1bFOGXMeX+pC4PZIPsvn2h1sArYOhgXQ=" crossorigin="anonymous"></script> 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous" defer></script> 

<script type="text/javascript" defer> 
    $(document).ready(function() { 
     $('.slider').bxSlider({ 
      slideWidth: 214, 
      minSlides: 1, 
      maxSlides: 3, 
      moveSlides: 1, 
      slideMargin: 20 
     }); 
    }); 
</script> 

Picture of how it looks after load

Picture of how it looks when I open the Console, forcing the script to reload

所有腳本都在身體的結束,所有的HTML內容