Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. $(function() {
  2. // whenever we hover over a menu item that has a submenu
  3. $('li.parent').on('click', function() {
  4. var $menuItem = $(this),
  5. $submenuWrapper = $('> .wrapper', $menuItem);
  6.  
  7. // grab the menu item's position relative to its positioned parent
  8. var menuItemPos = $menuItem.position();
  9.  
  10. // place the submenu in the correct position relevant to the menu item
  11. $submenuWrapper.css({
  12. top: menuItemPos.top,
  13. left: menuItemPos.left + Math.round($menuItem.outerWidth() * 0.75)
  14. });
  15. });
  16. });
  17.  
  18. .wrapper1 li:hover > .wrapper1 {
  19. display: block;
  20. }
  21.  
  22. $(document).ready(function(){
  23.  
  24. $(".wrapper ul li").click(function(){
  25. //do what ever you want to do with li
  26. });
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement