Измените переменную функции onclick и верните ее в тот же клик

Я использую этот плагин тотема jQuery https://github.com/buildinternet/totem

Мой код:

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 list, чтобы развернуть и показать все 4 li. переменные row_height: '34px', а также max_items:1 следует изменить значения на row_height : '130px', а также max_items: 4 При нажатии на ссылку HREF и вернуться к 1 на тот же клик.

1 ответ

Написать обработчик onClick для #news, изменить объект $.omr.totemticker.defaultOptions с новыми переменными max_items и row_height. $.omr.totemticker возвращается библиотекой при инициализации. Это должно помочь вам.

Другие вопросы по тегам