Reputation: 525
Not sure what I'm looking for but I was wondering if there's a way to change the name of a link when it's made active as well as it's destination. A toggle of sorts.
Below is a mock-up.
There will only be one button on show.
Upvotes: 0
Views: 172
Reputation: 525
I managed to solve this with CSS
.collection-506d943d84aead5098d63cc2
#main-navigation
.blog-collection {
display:none;
}
.collection-506daf5a84aead5098d68b94
#main-navigation
.page-collection {
display: none;
}
Upvotes: 0
Reputation: 4617
Use jQuery.
var linkObj = $("#linkId");
if(location.href == aboutUrl){
linkObj.attr("href", blogurl).html("BLOG");
}
else{
linkObj.attr("href", abouturl).html("ABOUT");
}
Upvotes: 1
Reputation: 23208
based on url you can change your link text and href.
var a = document.getElementById('linkId');
if(location.href == abouturl){
a.href = blogurl;
a.innerHTML = 'BLOG'
}
else{
a.href = abouturl;
a.innerHTML= 'ABOUT';
}
Upvotes: 2