I figured I'd share this snippet of Jquery I created for a friend. She was trying to get her sidebar links to have an active anchor that reflected where the user was in site currently. As her site was static (how dare she not use Drupal...) and she was using PHP includes for much of her content that she didn't want to replicate, Jquery seemed like the best option!
So, I created the following code, which essential does the following:
Here's the code:
$(document).ready(function() {
var pathname = window.location.pathname;
var pathname = pathname.split('/');
var tester = pathname[pathname.length-1];
$('#sidebar1 a').each(function(){
var test = $(this).attr('href');
if (test == tester){
$(this).addClass('active');
}
});
});
Not bad stuff eh?
If your URL’s don’t end with
If your URL’s don’t end with a slash but ... jQuery active link, active page.. I was recently asked to set the current page hyperlink (button) active, I did not ...!
I am using jQuery. I'd like to get the path of the current URL and assign it to a ... Set control to “active” on the href click? ... inject it into another url linkto change to the current active page. Setting this ... first argument is a URL. This function does not affect the current active ... during custom form and link binding jQuery ...! Industrial packing visakhapatnam
I figured I'd share this
I figured I'd share this snippet of Jquery I created for a friend. She was trying to get her sidebar links to have an active anchor that reflected where the user was in site currently. As her site was static (how dare she not use Drupal...) and she was using PHP includes for much of her content that she didn't want to replicate, Jquery seemed like the best option!
Saismic jobs in Alaska
I found the perfect place for
I found the perfect place for my needs. Contains wonderful and useful messages. I have read most of them and has a lot of them. To me, he's doing the great work.Burlap
A good code. I am very please
A good code. I am very please with your help. Thanks for sharing cable tunnels.
I used to be more than happy
I used to be more than happy to seek out this internet-site.I wanted to thanks in your time for this glorious read!! I positively enjoying each little bit of it and I have you bookmarked to check out new stuff you weblog post.
mcp test==
cse test==
CISSP test==
MCITP test==
MCSA test==
MCSE test==
I used to be more than happy
I used to be more than happy to seek out this internet-site.I wanted to thanks in your time for this glorious read!! I positively enjoying each little bit of it and I have you bookmarked to check out new stuff you weblog post.
used cars
Huge Selection of high
Huge Selection of high quality genuine watches - We remain in touch with the distributers,importers and whole sellers throughout the year to provide you right on time what is shown in the catalog.
casio watches pakistan=== casio watches in pakistan=== casio watches prices in pakistan=== casio watches=== casio edifice===
Thanks a lot. In my case, the
Thanks a lot. In my case, the script had to figure out the active link using an URL scheme like "index.php?pageID=52". Rotten. Anyway, the following script, based on the above, did the thing for me:
var pathname = 'index.php'+window.location.search;
$('#navigation a').each(function(){
if ($(this).attr('href') == pathname){
$(this).addClass('aktiv');
}
});
Cheers.
I must say you are very good
I must say you are very good in this subject, High Definition Wallpaper
I used to be more than happy
I used to be more than happy to seek out this internet-site.I wanted to thanks in your time for this glorious read!! I positively enjoying each little bit of it and I have you bookmarked to check out new stuff you weblog post.
70-432 braindumps
70-620 braindumps
70-686 braindumps
642-642 braindumps
Thanks for the very
Thanks for the very informative article and I extremely grateful that you perform this piece of writing very simply, I mean to say that it's quite simple to read and understand!
best translation service
Thanks a lot for the code I
Thanks a lot for the code I tried it and it worked fine after some changes. I was trying to do the same for my site and had a tough time to come out with some logic. After using the above code I completed a important part of my project and can continue further....Thanks a lot again...motivational speeches
Post new comment