Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. $('.sub-menu li').each(function(){
  2.  
  3. if ($('ul', this).length)
  4. {
  5. $(this).addClass('drop-menu-right');
  6. var copy = $(this); var next = copy.clone();
  7. var copy2 = $(this).parent().parent(); var prev = copy2.clone();
  8. next.find('ul li ul').remove(); prev.find('ul li ul').remove(); prev.find('.tree').remove();
  9. var title = next.find('a:first').html(); next.find('a:first').remove();
  10. var content = '<div class = "background"></div><div class = "menu-title">'+ title +'</div><div class = "sub-menu-slide">'+ next.html() +'<div class = "menu-back">Back</div></div>';
  11. next.html(content);
  12. next.find('.menu-back').attr('data-prev', prev.html());
  13. $(this).attr('data-next', next.html());
  14. }
  15.  
  16. }); // Works fine until there is a 5th .sub-menu li
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement