Showing posts with label attr. Show all posts
Showing posts with label attr. Show all posts

Wednesday, January 18, 2012

Setting the id of a link based on it"s href



$('.portfolioThumbs ul li a').mouseover(
function(){
var buttLink = $(this).attr('href')
var buttLinkArray = buttLink.split( '/' ); // Split the URL after each / and Create an array of each
var pFN = buttLinkArray[2]; // We want the Portfolio Folder Name
var url = window.location.pathname;

$('.galleryNav ul li a').removeClass('hovered');
$('.galleryNav ul li a' + '#' + pFN).addClass('hovered');
window.location.pathname = url + '#' + pFN;
}
);