Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('.sub-menu li').each(function(){
- if ($('ul', this).length)
- {
- $(this).addClass('drop-menu-right');
- var copy = $(this); var next = copy.clone();
- var copy2 = $(this).parent().parent(); var prev = copy2.clone();
- next.find('ul li ul').remove(); prev.find('ul li ul').remove(); prev.find('.tree').remove();
- var title = next.find('a:first').html(); next.find('a:first').remove();
- 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>';
- next.html(content);
- next.find('.menu-back').attr('data-prev', prev.html());
- $(this).attr('data-next', next.html());
- }
- }); // Works fine until there is a 5th .sub-menu li
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement