2015-09-06 70 views
0

我使用這個jQuery的圖騰插件https://github.com/buildinternet/totem更改功能變量的onclick並得到它回到了同一點擊

我的代碼:

的JavaScript

<script type="text/javascript"> 
     $(function(){ 
      $('#newslistul').totemticker({ 
       row_height : '34px', 
       max_items : 1 
       }); 
     }); 
</script> 

HTML

<!-- Start News Bar --> 
    <section id="news"> 
     <div class="container"> 
      <p>EV.news</p> 
      <div id="newslist"> 
       <ul id="newslistul"> 
        <li><a href="#" title=""><i class="fa fa-angle-right fa-lg" style="margin-right: 4px;"></i> May 25, 2010 Cras sodales augue a nulla tincidunt tincidu sce congue massa enim consequt nonummy</a></li> 
        <li><a href="#" title=""><i class="fa fa-angle-right fa-lg" style="margin-right: 4px;"></i> Apr 25, 2010 Vivamus sollicitudin erat ut turpis convallis eleife</a></li> 
        <li><a href="#" title=""><i class="fa fa-angle-right fa-lg" style="margin-right: 4px;"></i> Sept 25, 2010 Cras sodales augue a nulla tincidunt tincidu sce congue massa enim consequt nonummy</a></li> 
        <li><a href="#" title=""><i class="fa fa-angle-right fa-lg" style="margin-right: 4px;"></i> Sept 25, 2010 Headline lorem ipsum dolor sit amet, consectetur adipiscing elitc vamus id mauris eu mi rutrum tempus</a></li> 
       </ul> 
      </div><!-- /.newslist --> 
      <a href="#" id="news"><i class="fa fa-plus-square" style="position: relative; top: -8px; color: grey;"></i></a> 
     </div><!-- /.container --> 
    </section> 
    <!-- End News Bar --> 

我想要下一個: 當你點擊

<a href="#" id="news"><i class="fa fa-plus-square" style="position: relative; top: -8px; color: grey;"></i></a> 

鏈接,ul列表展開並顯示所有4個li。 變量row_height: '34px'max_items:1應將值更改爲row_height : '130px'max_items: 4單擊鏈接時href和adn在同一次單擊中返回1。

+0

這裏是實時預覽http://promo-moments.com/ev/ 它在上面。 EV新聞元素。 – bgolubovic

回答

0

爲#news編寫onClick處理程序使用新的max_items和row_height變量修改$ .omr.totemticker.defaultOptions對象。庫初始化時返回$ .omr.totemticker。 這應該對你有幫助。

+0

好的。謝謝。 首先在#news中添加onclick =「」a。 但是如何編寫這個腳本代碼? – bgolubovic

+0

這樣:$(「#target」).click(function(){alert(「Handler for .click()called。」); }); – Tarang

+0

我寫: $( 「#news」)。單擊(函數(){$ .omr.totemticker.defaultOptions({ row_height: '134px', MAX_ITEMS:4 }); }); 在#news a中輸入什麼onclick =「」? – bgolubovic

相關問題