javascript - JS slidetoggle on UL -


i trying slidetoggle ul's. stuck.

here question:

those codes working:

    <div class="splitleft" onclick="toggle_item(b)">         <?php echo $admin_logs ?>         <ul class="menu" id="b">             <li><a href="index.php?content=admin&page=show_logs_all"><?php echo $admin_logs_desc ?></a></li>             <li><a href="index.php?content=admin&page=show_logs_player"><?php echo $admin_watch_players ?></a></li>             <li><a href="index.php?content=admin&page=show_logs_admins"><?php echo $admin_watch_admins ?></a></li>         </ul>     </div> <script>function toggle_item(e){$(e).slidetoggle();}</script> 

but don't want it. want this:

<ul class="menu" onclick="toggle_item(b)" id="b">     <li><a href="index.php?content=admin&page=show_logs_all"><?php echo $admin_logs_desc ?></a></li>     <li><a href="index.php?content=admin&page=show_logs_player"><?php echo $admin_watch_players ?></a></li>     <li><a href="index.php?content=admin&page=show_logs_admins"><?php echo $admin_watch_admins ?></a></li> </ul> 

can 1 me :) i'm not on js..

your ul item not contain "space" on page if li items inside not visible. therefore clicking not if event attached ul.

you need attach event user can click on. without code clarify can speculate...

html:

<div class="splitleft">     <?php echo $admin_logs ?>     <a id="ulopener" href="#">click me open ul</a>     <ul class="menu" id="b">         <li><a href="index.php?content=admin&page=show_logs_all"><?php echo $admin_logs_desc ?></a></li>         <li><a href="index.php?content=admin&page=show_logs_player"><?php echo $admin_watch_players ?></a></li>         <li><a href="index.php?content=admin&page=show_logs_admins"><?php echo $admin_watch_admins ?></a></li>     </ul> </div> 

js:

jquery(function($) {      $('#ulopener').click(function() {         $('#b').slidetoggle();     }); }); 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -