php - Trouble with active element in my html page -
i'm looking method use css change display properties nav element related page active.
for example, if user on home page, 'home' button in navigation styled differently.
i use following code:
<li class="active"> <a href="<?php echo $sito ?>/index.php">home</a> </li> <li> <a href="<?php echo $sito ?>/page1.html">page1</a> </li> <li> <a href="<?php echo $sito ?>/page2.html">page2</a> </li>
when selecte page1 or page2, home button remain active!
use this
var $links = $('li'); $links.click(function(){ $links.removeclass('active'); $(this).addclass('active'); });
Comments
Post a Comment