Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changing default options

  • Loading branch information...
commit 572e70bf02ed446b77c90c0a0d68c2a94afb5512 1 parent 98387aa
@nhocki authored
Showing with 15 additions and 15 deletions.
  1. +5 −1 README.rdoc
  2. +3 −2 slidingmenu.js
  3. +1 −1  slidingmenu.min.js
  4. +6 −11 test.html
View
6 README.rdoc
@@ -13,7 +13,7 @@ You can configure some options. Here I'll show the default ones:
animationSpeed : 'fast'
slideUpInner : true // if false, the sub-menus will stay visible even if it's parent is hidden
slideDownInner : false // if true, all the navigation levels will be visible when a top level is clicked
- triggerElement : "h1.menu-title" // The element you want to trigger the event
+ triggerElement : ".menu-title" // The element you want to trigger the event
holderElement : ".menu-items" // The element that holds the actual items
The basic HTML structure is quite simple.
@@ -29,6 +29,10 @@ The basic HTML structure is quite simple.
You can check out the test page for another HTML structure. Notice that the menu items can be any html tag and not only list items.
+= TODO
+
+* Add styling to the test page
+
= CONTRIBUTORS
Nicolás Hock Isaza ({nhocki}[https://github.com/nhocki])
View
5 slidingmenu.js
@@ -6,12 +6,12 @@
animationSpeed : 'fast',
slideUpInner : true,
slideDownInner : false,
- triggerElement : "h1.menu-title",
+ triggerElement : ".menu-title",
holderElement : ".menu-items"
},
params
);
- $(settings.triggerElement, this).click(function(){
+ $(settings.triggerElement, this).click(function(event){
if(settings.slideUpInner == true){
@@ -33,6 +33,7 @@
$(settings.holderElement+":hidden", $(this).parent()).slideDown(settings.animationSpeed);
}
+ return false;
});
};
})(jQuery);
View
2  slidingmenu.min.js
@@ -1 +1 @@
-(function($,undefined){$.fn.slidingMenu=function(params){var settings=jQuery.extend({},{animationSpeed:"fast",slideUpInner:true,slideDownInner:false,triggerElement:"h1.menu-title",holderElement:".menu-items"},params);$(settings.triggerElement,this).click(function(){if(settings.slideUpInner==true){$(settings.holderElement+":visible",$(this).parent()).slideUp(settings.animationSpeed);}else{var vs=$(settings.holderElement,$(this).parent()).first();if(vs.is(":visible")){vs.slideUp(settings.animationSpeed);}}if(settings.slideDownInner==false){var ho=$(settings.holderElement,$(this).parent()).first();if(ho.is(":hidden")){ho.slideDown(settings.animationSpeed);}}else{$(settings.holderElement+":hidden",$(this).parent()).slideDown(settings.animationSpeed);}});};})(jQuery);
+(function(a,b){a.fn.slidingMenu=function(d){var c=jQuery.extend({},{animationSpeed:"fast",slideUpInner:true,slideDownInner:false,triggerElement:".menu-title",holderElement:".menu-items"},d);a(c.triggerElement,this).click(function(e){if(c.slideUpInner==true){a(c.holderElement+":visible",a(this).parent()).slideUp(c.animationSpeed);}else{var g=a(c.holderElement,a(this).parent()).first();if(g.is(":visible")){g.slideUp(c.animationSpeed);}}if(c.slideDownInner==false){var f=a(c.holderElement,a(this).parent()).first();if(f.is(":hidden")){f.slideDown(c.animationSpeed);}}else{a(c.holderElement+":hidden",a(this).parent()).slideDown(c.animationSpeed);}return false;});};})(jQuery);
View
17 test.html
@@ -1,26 +1,21 @@
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"> </script>
- <script type="text/javascript" src="slidingmenu.min.js"> </script>
+ <script type="text/javascript" src="slidingmenu.js"> </script>
<script type="text/javascript">
$(function(){
$(".menu-items").hide();
- $("h1").css("cursor", "pointer");
- $(".menu-holder").slidingMenu(
- {
- triggerElement: "h1"
- }
- );
+ $(".menu-holder").slidingMenu();
});
</script>
</head>
<body>
<div class="menu-holder">
- <h1>Menu item 1</h1>
+ <a class="menu-title" href="#">Menu item 1</a>
<ul class="menu-items">
<li>
<div class="menu-holder">
- <h1>Level 2 menu</h1>
+ <a class="menu-title" href="#">Level 2 Menu</a>
<ul class="menu-items">
<li>Chunky Bacon!</li>
<li>Foo</li>
@@ -28,7 +23,7 @@
<li>
<div class="menu-holder">
- <h1>Level 3 menu</h1>
+ <a class="menu-title" href="#">Level 3 Menu</a>
<ul class="menu-items">
<li>Bar</li>
<li>Lipsum</li>
@@ -48,7 +43,7 @@
<li>
<div class="menu-holder">
- <h1>Another Level 2 Menu</h1>
+ <a class="menu-title" href="#">Another Level 2 Menu</a>
<ul class="menu-items">
<li>And it has some items!</li>
<li>This could be <em><strong>any</strong></em> html content!</li>
Please sign in to comment.
Something went wrong with that request. Please try again.