简体   繁体   English

更改函数变量onclick并再次单击它

[英]Change function variable onclick and get it back on the same click

I am using this jQuery totem plugin https://github.com/buildinternet/totem 我正在使用这个jQuery图腾插件https://github.com/buildinternet/totem

My code: 我的代码:

JavaScript 的JavaScript

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

HTML 的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 -->

I want next: When you click on 我要下一个:当您单击

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

link, ul list to expand and show all 4 li. 链接,ul列表以展开并显示所有4 li。 Variables row_height: '34px' , and max_items:1 should change values to row_height : '130px' , and max_items: 4 on click on link a href adn get back to 1 on the same click. 变量row_height: '34px'max_items:1值应更改为row_height : '130px'max_items: 4 ,单击链接时,href和max_items: 4单击一次时返回1。

Write an onClick handler for #news modify $.omr.totemticker.defaultOptions object with new max_items and row_height variable. 编写一个onClick处理程序,以使用新的max_items和row_height变量#news修改$ .omr.totemticker.defaultOptions对象。 $.omr.totemticker is returned by the library when initializing it. $ .omr.totemticker在初始化时由库返回。 That should help you. 那应该对你有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM