Edit New Message navbar link using CSS
5 posters
Page 1 of 1
Edit New Message navbar link using CSS
Hello everyone
I'm working on a forum theme and I've chosen to add retina display support on all my images. To reduce loading time for non retina users, I went for the text only navigation buttons (like here on the support forums).
I'm fully aware that you can edit individual links using CSS (a[href="/Portal"],a[href="/Forum"], etc etc) but I'm stuck on the "You have 1 new message" button since it shares the same link with "You have no new messages" button. I want it so that when a user receives a new message in his inbox, the color of the button's text changes.
If it makes any difference, I'm using PunBB.
Thanks!
I'm working on a forum theme and I've chosen to add retina display support on all my images. To reduce loading time for non retina users, I went for the text only navigation buttons (like here on the support forums).
I'm fully aware that you can edit individual links using CSS (a[href="/Portal"],a[href="/Forum"], etc etc) but I'm stuck on the "You have 1 new message" button since it shares the same link with "You have no new messages" button. I want it so that when a user receives a new message in his inbox, the color of the button's text changes.
If it makes any difference, I'm using PunBB.
Thanks!
Re: Edit New Message navbar link using CSS
Hello ,
You can use this CSS to style the new message navlink :
You can use this CSS to style the new message navlink :
- Code:
.new-message { color:red; }
Re: Edit New Message navbar link using CSS
Ange Tuteur wrote:Hello ,
You can use this CSS to style the new message navlink :
- Code:
.new-message { color:red; }
Hey,
thanks for the response! I've already tried that code however, and it's not working
Re: Edit New Message navbar link using CSS
- Code:
.new-message { color: red !important; }
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Edit New Message navbar link using CSS
SLGray wrote:
- Code:
.new-message { color: red !important; }
Sorry. That didn't work either =/
Re: Edit New Message navbar link using CSS
Sir Chivas wrote:Try this:
- Code:
span.new-message {
color: red; !important;
}
Still no dice... not working
Re: Edit New Message navbar link using CSS
Hi ,
I have checked PunBB and it does not have the selector unfortunately. You can however, achieve it with javascript :
Administration Panel > Modules > Javascript codes management > Create a new script
Title : what you wish
Placement : in all the pages
Paste the code below and submit :
You can change the color here :
from color names to hex colors (you should change plural color as well)
I have checked PunBB and it does not have the selector unfortunately. You can however, achieve it with javascript :
Administration Panel > Modules > Javascript codes management > Create a new script
Title : what you wish
Placement : in all the pages
Paste the code below and submit :
- Code:
jQuery(function() {
var num = jQuery('a.mainmenu[href="/privmsg?folder=inbox"]').text().replace(/You have ([0-9]+) new message/,'$1');
jQuery('a.mainmenu[href="/privmsg?folder=inbox"]:contains(You have '+num+' new message)').css('color','yellow');
/* Plural */
var nums = jQuery('a.mainmenu[href="/privmsg?folder=inbox"]').text().replace(/You have ([0-9]+) new messages/,'$1');
jQuery('a.mainmenu[href="/privmsg?folder=inbox"]:contains(You have '+nums+' new messages)').css('color','yellow');
});
You can change the color here :
from color names to hex colors (you should change plural color as well)
- Code:
.css('color','yellow')
Re: Edit New Message navbar link using CSS
Still refusing to work ... The code I'm using is:
By the way, I'm also using Javascript to change the text itself... for example:
But even when the above Javascript module is turned off and everything is reverted back to native settings, the code you gave isn't working =/...
Thank you in advance.[/code]
- Code:
jQuery(function() {
var num = jQuery('a.mainmenu[href="/privmsg?folder=inbox"]').text().replace(/You have ([0-9]+) new message/,'$1');
jQuery('a.mainmenu[href="/privmsg?folder=inbox"]:contains(You have '+num+' new message)').css('color','#423420');
/* Plural */
var nums = jQuery('a.mainmenu[href="/privmsg?folder=inbox"]').text().replace(/You have ([0-9]+) new messages/,'$1');
jQuery('a.mainmenu[href="/privmsg?folder=inbox"]:contains(You have '+nums+' new messages)').css('color','#423420');
});
By the way, I'm also using Javascript to change the text itself... for example:
- Code:
$(function(){
$('a.mainmenu:contains("You have 1 new message")').text('Inbox');
});
But even when the above Javascript module is turned off and everything is reverted back to native settings, the code you gave isn't working =/...
Thank you in advance.[/code]
Re: Edit New Message navbar link using CSS
Please post a link to the forum you're adding this to.
Thanks
Thanks
Re: Edit New Message navbar link using CSS
Here's the test forum I'm working on at the moment:
http://aqmen.forumotion.com
http://aqmen.forumotion.com
Re: Edit New Message navbar link using CSS
sif bakheti wrote:yes this is thanks
Please do not post in a topic unless you are offering a solution or asking for help.
Re: Edit New Message navbar link using CSS
Hi,
Apologies for the delay. Try this instead :
Administration Panel > Modules > Javascript codes management > Create a new script
Title : New message
Placement : In all the pages
Paste the code below and submit :
Then add this to your CSS :
Administration Panel > Display > Pictures and colors > Colors > CSS stylesheet
Apologies for the delay. Try this instead :
Administration Panel > Modules > Javascript codes management > Create a new script
Title : New message
Placement : In all the pages
Paste the code below and submit :
- Code:
$(document).ready(function() {
var P = 'a.mainmenu[href="/privmsg?folder=inbox"]';
var N = 'new-message';
var n1 = $(P).text().replace(/You have ([0-9]+) new message/,'$1');
var n2 = $(P).text().replace(/You have ([0-9]+) new messages/,'$1');
$(P+':contains(You have '+n1+' new message)').addClass(N);
$(P+':contains(You have '+n2+' new messages)').addClass(N);
});
Then add this to your CSS :
Administration Panel > Display > Pictures and colors > Colors > CSS stylesheet
- Code:
.new-message { color:#ff0 !important; }
Similar topics
» A link to a users wall "Visitors Messages" in their Message Profile + A Pop-up Message When a User Posts a Message There! PunBB
» Edit the Navbar
» Navbar edit
» i can't edit my navbar
» How can I edit the Navbar text?
» Edit the Navbar
» Navbar edit
» i can't edit my navbar
» How can I edit the Navbar text?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum