-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.jd-sliding-columns-menu.min.js
8 lines (8 loc) · 2.08 KB
/
jquery.jd-sliding-columns-menu.min.js
1
2
3
4
5
6
7
8
/*
* jQuery Sliding Columns Menu 0.1
* Demo's and doc :
* www.dosne.net (Soon)
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/(function(a){var b={version:"0.1",width:150,backButtonLabel:"Back",classNamePrefix:"jd-scm-"};a.fn.jdScMenu=function(c){var d=null,e=a(this);c!==undefined&&(b=a.extend(b,c));e.css({width:b.width+"px",height:b.width+"px",position:"relative",border:"1px solid black"});e.wrap('<div id="'+b.classNamePrefix+'wrapper" />');var f=a("#"+b.classNamePrefix+"wrapper");f.append('<div id="'+b.classNamePrefix+'content" />');f.css("width",b.width);var g=a("#"+b.classNamePrefix+"content");g.css({position:"absolute",top:"0px",left:-1*b.width+"px"});var h=0;e.attr("id","slide0").data({id:h}).find("li:has(ul)").each(function(){h++;a(this).addClass(""+b.classNamePrefix+"has-child").attr("id",""+b.classNamePrefix+"li"+h).data({id:h});a(this).children("ul").attr("id",""+b.classNamePrefix+"slide"+h).data({id:h})});f.find("ul").each(function(){var c=a('<div id="'+b.classNamePrefix+"slide"+a(this).data("id")+'" />');g.append(c);a(this).children("li").clone(!0).appendTo(c);c.addClass(""+b.classNamePrefix+"slide").data({id:a(this).data("id")}).css("width",b.width).css("left",b.width*2).hide().find("ul").remove()});a("."+b.classNamePrefix+"slide:not(:first)").prepend('<li class="'+b.classNamePrefix+'back">'+b.backButtonLabel+"</li>");a("."+b.classNamePrefix+"back").click(function(c){var d=a(this).parent(),e=a("#"+b.classNamePrefix+"li"+a(this).parent().data("id")).parent();e.show().css("left",0).animate({left:b.width});d.animate({left:b.width*2},{complete:function(){}});f.animate({height:e.height()});c.stopPropagation()});g.find("li."+b.classNamePrefix+"has-child").click(function(c){var d=a(this).parent(),e=a("#"+b.classNamePrefix+"slide"+a(this).data("id"));e.show().css("left",b.width*2).animate({left:b.width});d.animate({left:0},{complete:function(){}});f.animate({height:e.height()});c.stopPropagation()});e.remove();a("#"+b.classNamePrefix+"slide0").css("left",b.width).show();f.animate({height:a("#"+b.classNamePrefix+"slide0").height()})}})(jQuery);