javascript - Have navigation slide down on document load just for the homepage -


i'm new javascript/jquery , wanting have menu animate in when landing on homepage , have menu show , not animate other pages.

the code below have been playing with.

$(document).ready(function(){ if (document.location.href.indexof('localhost:8888') > -1 ) {    //slide down menu } else {    //static menu } }); 

you can use css3 animations accomplish this

jsfiddle demo

set <body> of homepage have class homepage

<body class="homepage">     <nav>         nav (w/ul+li nav items)     </nav>      <!--...--> </body> 

then either create own animation or use pre-built set animate.css

.homepage nav {     -webkit-animation:fadeindown .5s;     -moz-animation:fadeindown .5s;     animation:fadeindown .5s; } 

edit:

to add class homepage in wordpress:

combining answers add custom class name wordpress body tag? , is_home() wordpress function

add functions.php (disclaimer:i haven't tested should 99% of way there)

function my_plugin_body_class($classes) {     //if (is_home()) {     if (is_front_page()) {         $classes[] = 'homepage';         //return $classes;     }     return $classes; }  add_filter('body_class', 'my_plugin_body_class'); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -