Rai Abdullah
Rai Abdullah

Reputation: 17

jquery auto open slide menu when page load

i have an wordpress site and it have menus over there. what i want is this that when some body hover the SITE logo then it's showing the drop down menus.... what i am trying to do is be always open not only when im clicking. it have to load when page get refreshed,

can any body tell that how to do that?

Upvotes: 0

Views: 1727

Answers (2)

NDBoost
NDBoost

Reputation: 10634

.ready() - use this to ensure the object being referenced is in a ready state.

Documentation - http://api.jquery.com/ready/

css() - use this to modify the CSS values of a property

Documentation: http://api.jquery.com/css/

Code Example

//only execute when the document returns ready
//this can be trivial if your putting the code at the footer
//you may wish to use a self invoking function in that case
$(document).ready(function(){
  setTimeout(function(){
    //do something
    $('#somethingcool').css('background-color', 'red');

  //3 seconds = 3000ms
  }, 3000);
});

Upvotes: 0

FGreg
FGreg

Reputation: 15330

Use $(document).ready(function() {} to run code after the page loads. You can then use the JQuery delay() function to wait for 3 seconds before calling slideDown on your menu object. Something like this would work:

$(document).ready(function() {
    $('#yourMenuID').delay(3000).slideDown(300);
}

http://api.jquery.com/delay/

Upvotes: 2

Related Questions