Welcome Guest, Not a member yet? Register   Sign In
jquery help
#1

[eluser]richzilla[/eluser]
Hi all, i know this isnt technically codeigniter, but these forums are the best for getting a sensible answer. Basically im trying to find away to highglight the current page, so for example the link in the navigation bar is highlighted when you are on that page. Ive thought of a jquery solution but it doesnt seem to be working:

I have this in my header;
Code:
[removed]
$(document).ready(function(){
    $("#nav a").each(function(){
            if($(this).attr("page_id") == <?php echo $page_id; ?>)
            {
                $(this).addClass("active");
            }
        });
});

[removed]

and in my header view:

Code:
<div id="nav">

&lt;?php echo anchor('home','Home',array('page_id' => 13)); ?&gt;
            
&lt;?php echo anchor('upgrade-and-repair','Upgrade &amp; Repair',array('page_id' => 14)); ?&gt;
            
&lt;?php echo anchor('data','Data Recovery',array('page_id' => 12)); ?&gt;
            
&lt;?php echo anchor('about','About',array('page_id' => 11)); ?&gt;
            
&lt;?php echo anchor('contact','Contact',array('page_id' => 10)); ?&gt;

</div>

any ideas where im going wrong?


Messages In This Thread
jquery help - by El Forum - 01-23-2010, 03:39 PM
jquery help - by El Forum - 01-23-2010, 04:11 PM
jquery help - by El Forum - 01-24-2010, 12:30 AM
jquery help - by El Forum - 01-24-2010, 01:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB