How to create a bounce effect on a ul

I am using a page that has a menu. when you select the menu (mouseover or mouse movement) drop down ul appears. Here is the code

<head>  
    <script type="text/javascript" src="js/jquery-1.7.1.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.8.17.custom.min.js"></script>  
    <script type="text/javascript" language="javascript" src="js/jquery.dropdown.js"></script>   
    <script type="text/javascript" src="js/myBounce.js"></script>
    <script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script> 
</head>

<body>

    <div id="page-wrap">
        <div id="menubg">      
            <ul class="dropdown">   
                <li><a href="#">Really Tall Menu</a>
                    <ul>
                        <li><a href="#">Basit</a></li>
                        <li><a href="#">Masood</a></li>
                         ...                     
                   </ul>
                </li>
                <li><a href="#">Kinda Tall Menu</a>
                    <ul id="test">
                        <li><a href="#">Artificial Turf</a></li>
                        <li><a href="#">Benches &amp; Bleachers</a></li>
                        <li><a href="#">Communication Devices</a></li>
                        ..
                    </ul>
                </li>
            </ul>       
    </div>
</body>

      

js / jquery-ui-1.8.17.custom.min.js contains a bounce effect. I want that when my ul appears, it appears with a bounce effect. I have a lot of ul's on my page. In myBounce.js I used the following code but it doesn't work

$(document).ready(function(){
    $("ul").effect("bounce");
});

      

How can I create a bounce effect on a ul?

thank

+3


source to share


2 answers


You should use jQuery ui show advanced method to add effect when you show your ul



$( "#id_of_your_ul" ).show( 'bounce');

      

+1


source


Using your html try this:



<style type="text/css">
    ul li ul {
        display: none;
    }
</style>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js"></script>

<script type="text/javascript">
    $(document).ready(function () {
       $('ul.dropdown > li > a').click(function (e) {
           e.preventDefault();
           $(this).closest('li').children('ul').show().effect('bounce');
       });
    });
</script>

      

0


source







All Articles