Also when dealing with Subtext, it's not that simple, I'm trying to figure
out how do that in Subtext...the example you spoke of but it's difficult, I
need to figure out where I can do this since it's a bit complicated in how
they are rending their user controls, default.aspx, etc.


expresso wrote:
> 
> Problem with the JavaScript is that you loose the css value after you're
> redirected to whatever page.  You'd have to obviously have to either do
> some if statements to check which .aspx page y ou went to or send the id
> of the anchor over in a querystring then grab it in JavaScript to set it
> again once you get to that page or else you loose the css that you set due
> to redirect oviously.
> 
> 
> mkmanning wrote:
>> 
>> 
>> You can do still do it with asp:
>> http://stackoverflow.com/questions/188124/programmatic-solution-to-change-navigation-id-to-highlight-current-page-asp-net
>> 
>> Or if you really want to use JavasScript, the same solution above
>> applies:
>> 
>> var pathname = window.location.pathname;
>> pathname = pathname.substring(pathname.lastIndexOf('/')
>> +1,pathname.indexOf('.asp'))
>> $('body').addClass(pathname);
>> 
>> 
>> 
>> On Mar 1, 5:47 pm, expresso <dschin...@gmail.com> wrote:
>>> But I'm using a asp.net master page and inheriting it's body.  so my
>>> pages
>>> only will have one global body tag.
>>>
>>>
>>>
>>> mkmanning wrote:
>>>
>>> > Unless your only option is to resort to JavaScript, this is something
>>> > you could do with CSS alone, if you put an id or class on the body tag
>>> > for each page and just rely on the CSS hierarchy to change the style
>>> > for each list item. It also has the advantage of working immediately,
>>> > instead of waiting for domready for example, and even works when
>>> > script is disabled, and can reduce code complexity.
>>>
>>> > CSS:
>>> > body.home ul li.home,
>>> > body.about ul li.about,
>>> > body.contact ul li.contact {
>>> >    color:red;
>>> > }
>>>
>>> > HTML:
>>>
>>> > <body class="about">
>>>
>>> > <div id="menu">
>>> >         <ul>
>>> >               <li class="home"> default.aspx home </li>
>>> >               <li class="about"> about.aspx about </li>
>>> >              <li class="contact"> contact.aspx contact </li>
>>> >         </ul>
>>> > </div>
>>>
>>> > On Mar 1, 4:53 pm, expresso <dschin...@gmail.com> wrote:
>>> >> I'm trying to do something simple but this is my first stab at doing
>>> this
>>> >> in
>>> >> JQuery.
>>>
>>> >>             <div id="menu">
>>> >>                     <ul>
>>> >>                             <li class="current_page_item">
>>> default.aspx
>>> >> home </li>
>>> >>                             <li> about.aspx about </li>
>>> >>                             <li> contact.aspx contact </li>
>>> >>                     </ul>
>>> >>             </div>
>>>
>>> >> based on the page, change the css.  So like doing a window.location
>>> and
>>> >> then
>>> >> parse out the url to the page then check.  If it's the about.aspx I
>>> need
>>> >> to
>>> >> change the li item's css.
>>> >> --
>>> >> View this message in
>>> >>
>>> context:http://www.nabble.com/Change-CSS-depending-on-page-you%27re-on-tp2228...
>>> >> Sent from the jQuery General Discussion mailing list archive at
>>> >> Nabble.com.
>>>
>>> --
>>> View this message in
>>> context:http://www.nabble.com/Change-CSS-depending-on-page-you%27re-on-tp2228...
>>> Sent from the jQuery General Discussion mailing list archive at
>>> Nabble.com.
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Change-CSS-depending-on-page-you%27re-on-tp22280342s27240p22281862.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to