Jquery

JQuery Tutorials

JQuery Resources

                                                   JQuery




ExploreJQuery.Com

 





JQuery Lightbox
 





 JQuery Accordion





JQuery Autocomplete
 

 Affiliate Marketing Recommended Products

The Affiliate Code   Profit Miracle   Maverick Money Makers
               

The Affiliate Code is an amazing training product by Michael Jones. He will teach you how he made $65,000 in one month. Michael Jones is also the creator of the extremely popular ClickBank Code.

 

Profit Miracle is a great product that will provide you with a shortcut on creating and marketing your content. This product will save you time and money with your affiliate marketing ventures

 

Maverick Money Makers was developed by millionaires and has proven to generate at least $354.97 per day from home when you are just starting out. This course is good for beginners and intermediate affiliates

Read more>>>   Read more>>>   Read more>>>
   
   
   
  Bookmark and Share
  
Jquery Sliding Top Menu
      
Feb
23
Jamal Ahmad

jam05pgs

0 Comments  |   3850 Hits
Tags:   jquery sliding menu, jquery menus, menus
 

Sliding Menus are very effective in areas where we have limited space .This is a sliding top menu built with jQuery which can be fired through the open & close buttons or with any tag with the related class name.

Sliding Top Menu

Step 1 – HTML:  

<div id="sliderWrap">
    <div id="openCloseIdentifier"></div>
    <div id="slider">
        <div id="sliderContent">
            Isn't this nice?
        </div>
        <div id="openCloseWrap">
            <a href="#" class="topMenuAction" id="topMenuImage">
                <img src="open.png" alt="open" />
            </a>
        </div>
    </div>
</div>

Step 2 – CSS

<style type="text/css">
body {
margin: 0;
font-size:16px;
color: #000000;
font-family:Arial, Helvetica, sans-serif;
}
#sliderWrap {
margin: 0 auto;
width: 300px;
}
#slider {
position: absolute;
background-image:url(slider.png);
background-repeat:no-repeat;
background-position: bottom;
width: 300px;
height: 159px;
margin-top: -141px;
}
#slider img {
border: 0;
}
#sliderContent {
margin: 50px 0 0 50px;
position: absolute;
text-align:center;
background-color:#FFFFCC;
color:#333333;
font-weight:bold;
padding: 10px;
}
#header {
margin: 0 auto;
width: 600px;
background-color: #F0F0F0;
height: 200px;
padding: 10px;
}
#openCloseWrap {
position:absolute;
margin: 143px 0 0 120px;
font-size:12px;
font-weight:bold;
}
</style>

With the CSS file there are few major points:

  • #slider has to be positioned absolutely, so it can overlay the other content.
  • #slider has a negative top-margin which hides it.
  • #sliderContent is positioned absolutely to not to crack the open/close buttons
  • #openCloseWrap holding the buttons are positioned absolutely too.

Step 3 – jQuery / JavaScript

<script type="text/javascript">
$(document).ready(function() {
    $(".topMenuAction").click( function() {
        if ($("#openCloseIdentifier").is(":hidden")) {
            $("#slider").animate({
                marginTop: "-141px"
                }, 500 );
            $("#topMenuImage").html('<img src="open.png"/>');
            $("#openCloseIdentifier").show();
        } else {
            $("#slider").animate({
                marginTop: "0px"
                }, 500 );
            $("#topMenuImage").html('<img src="close.png"/>');
            $("#openCloseIdentifier").hide();
        }
    }); 
});
</script>

The main trick is changing the top margin of #slider and update the open / close images.

We have an empty element named openCloseIdentifier which shows us whether the menu is open or closed. We simply hide it when the menu is open and show when it is closed.

Then all we do is:

if openCloseIdentifier = hidden then close the menu or if openCloseIdentifier = visible then open the menu.

Sliding effect can be fastened by changing the 500 value in JavaScript to a smaller number or else.

JQuery Sliding Top Menu Demo

JQuery Sliding Top Menu Download

[ Stumble Upon ] [ Facebook ] [ del.icio.us ] [ furl ] [Sphinn] [ Digg ] [ Twitter ] [ Technorati ] [ Reddit ] [ Subscribe To RSS Feeds ]

0

 
 
 
   
 
Leave your comments
 
  Your comments  

     
name  

     
  email  

     
website    

     
5 + 3 =    

     
   
     

 

 

Follow me on twitter

Follow me on facebook

 

 
   

   

affiliate_link

   

affiliate_link

   

Buy Now - PayPal

   
 
   
  JQuery Community
 
 
tissa
darrenrowse
amour
niculae
sassyqarla
summerzeet
electrostar
good-pens
kh
travelhotelworld
tunyalitk
masterartrep
dain22
bloggersun
jameslove4enao
thebeespace
majalahpatani
caryngf
wonkapromotions
jam05pgs
 
  View more bloggers   Join Community
   
   
  JQuery Popular Posts
 
 
JQuery Beautiful Image Slide Show in New Way
Good Pens, Saturday 18th April 2009

Ajax Animated Live Search
Tunya Litk, Monday 4th May 2009

Ajax instant edit
Jamal Ahmad, Friday 15th May 2009

JQuery Autocomplete with Ajax PHP and MySQL
Jamal Ahmad, Sunday 14th June 2009

Ajax fancy Captcha with JQuery and PHP
Majalah Patani, Friday 8th May 2009
   
   
  JQuery Poll
 
 

Would you like to have a website which will provide you all facilities listen music, friendship, photo sharing and blog?

 

Yes

No
I dont know
 

 
   
  JQuery Categories
 
 
JQuery
JQuery AJAX
JQuery Banners
JQuery Browsing
JQuery CSS
JQuery Forms
   
   
   

 

 

 

 

© Copyright Explore JQuery, all rights reserved
A company registered in north America, Europe, Asia and Middle East as Explore Group.