The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Background color postprofile by rank

View previous topic View next topic Go down

Solved Background color postprofile by rank

Post by Sativa on March 13th 2017, 4:59 pm

Technical Details


Forum version : #phpBB3
Position : Founder
Concerned browser(s) : Mozilla Firefox, Google Chrome
Screenshot of problem : https://i.imgsafe.org/6c0f16bee3.jpeg + https://i58.servimg.com/u/f58/16/55/80/54/captur11.png
Who the problem concerns : All members
Forum link : http://castelobruxorpg.foroactivo.com/

Description of problem

Hello, it's me again it turns out that the code that I did to put the background to the profiles according to the rank only works in the first post of the forums. What do I have to do to make it work in all posts?
This is my js code. Thanks you all rock
Code:
$(document).ready(function(){
$('#perfil-cuerpo:has(".admin") #perfil-rotulo').css('background-color','#C595B4');
  $('#perfil-cuerpo:has(".mod") #perfil-rotulo').css('background-color','#A24C83');
  $('#perfil-cuerpo:has(".awa") #perfil-rotulo').css('background-color','#69A0A2');
  $('#perfil-cuerpo:has(".enawene") #perfil-rotulo').css('background-color','#919653');
  $('#perfil-cuerpo:has(".xapiri") #perfil-rotulo').css('background-color','#CEA04B');
  $('#perfil-cuerpo:has(".inter") #perfil-rotulo').css('background-color','#CE4B4B');
  $('#perfil-cuerpo:has(".castel") #perfil-rotulo').css('background-color','#8A6763');
  $('#perfil-cuerpo:has(".consej") #perfil-rotulo').css('background-color','#CB6034');
  $('#perfil-cuerpo:has(".cura") #perfil-rotulo').css('background-color','#B6C53F');
  $('#perfil-cuerpo:has(".adul") #perfil-rotulo').css('background-color','#7D637C');
  $('#perfil-cuerpo:has(".otro") #perfil-rotulo').css('background-color','#878E8E');
});


Last edited by Sativa on March 30th 2017, 10:30 pm; edited 2 times in total
avatar
Sativa
New Member

Female Posts : 11
Reputation : 1
Language : Spanish, English

http://castelobruxorpg.foroactivo.com/

Back to top Go down

Solved Re: Background color postprofile by rank

Post by brandon_g on March 13th 2017, 8:58 pm

Hello,

Just to clarify: You are trying to add a background color to every post of a user who has a certain rank? Like in the image below:


If I am understanding correctly, please let me know.

-Brandon


Remember to mark your topic when a solution is found.
avatar
brandon_g
Support Moderator
Support Moderator

Male Posts : 5731
Reputation : 526
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

Solved Re: Background color postprofile by rank

Post by Sativa on March 13th 2017, 9:42 pm

Yes, I think is something like that, I managed to put it in the first post. But I do not understand why in the rest post do not work.
avatar
Sativa
New Member

Female Posts : 11
Reputation : 1
Language : Spanish, English

http://castelobruxorpg.foroactivo.com/

Back to top Go down

Solved Re: Background color postprofile by rank

Post by brandon_g on March 14th 2017, 4:08 am

Ok, try using a simpler code.

Try the one in this topic (follow the instructions in ange tuteur's 1st post): http://help.forumotion.com/t137582-javascript-for-an-image . This code works and should do what your looking to do.

-Brandon


Remember to mark your topic when a solution is found.
avatar
brandon_g
Support Moderator
Support Moderator

Male Posts : 5731
Reputation : 526
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

Solved Re: Background color postprofile by rank

Post by Sativa on March 14th 2017, 12:49 pm

blackeye I'm trying, but I think it's not what I'm looking for because the code you've sent is for the background of the post. I want to put background-color on the users name like the picture. My js code just work in the first post, but I do not understand why it does not work with the rest.
avatar
Sativa
New Member

Female Posts : 11
Reputation : 1
Language : Spanish, English

http://castelobruxorpg.foroactivo.com/

Back to top Go down

Solved Re: Background color postprofile by rank

Post by brandon_g on March 14th 2017, 2:52 pm

Oh, I thought you meant post background color like in my picture. If you are only looking for username background color, then I am not sure. I do not believe I can help you with that. Let's wait for another member or staff to post here and see if they know.

-Brandon


Remember to mark your topic when a solution is found.
avatar
brandon_g
Support Moderator
Support Moderator

Male Posts : 5731
Reputation : 526
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

Solved Re: Background color postprofile by rank

Post by Sativa on March 14th 2017, 3:47 pm

Ty anyway @brandon_g I appreciate
avatar
Sativa
New Member

Female Posts : 11
Reputation : 1
Language : Spanish, English

http://castelobruxorpg.foroactivo.com/

Back to top Go down

Solved Re: Background color postprofile by rank

Post by Sativa on March 17th 2017, 6:03 pm

bump
avatar
Sativa
New Member

Female Posts : 11
Reputation : 1
Language : Spanish, English

http://castelobruxorpg.foroactivo.com/

Back to top Go down

Solved Re: Background color postprofile by rank

Post by Sativa on March 21st 2017, 11:17 pm

up.
avatar
Sativa
New Member

Female Posts : 11
Reputation : 1
Language : Spanish, English

http://castelobruxorpg.foroactivo.com/

Back to top Go down

Solved Re: Background color postprofile by rank

Post by Sativa on March 24th 2017, 2:56 pm

@Sativa wrote:up.
avatar
Sativa
New Member

Female Posts : 11
Reputation : 1
Language : Spanish, English

http://castelobruxorpg.foroactivo.com/

Back to top Go down

Solved Re: Background color postprofile by rank

Post by Sativa on March 29th 2017, 4:12 pm

bump!
avatar
Sativa
New Member

Female Posts : 11
Reputation : 1
Language : Spanish, English

http://castelobruxorpg.foroactivo.com/

Back to top Go down

Solved Re: Background color postprofile by rank

Post by Kyo Panda on March 29th 2017, 4:49 pm

The problem is a little techie, and it happens because your username titles use ID instead of classes in the HTML code. Long story short: IDs should only exist once in your HTML, classes can be many. As your titles uses IDs instead classes, the Javascript assumes that they are only one and applies the effect as such.

Try changing the code to:

Code:
$(document).ready(function(){
  $('div[id="perfil-cuerpo"]:has(".admin") div[id="perfil-rotulo"]').css('background-color','#C595B4');
  $('div[id="perfil-cuerpo"]:has(".mod") div[id="perfil-rotulo"]').css('background-color','#A24C83');
  $('div[id="perfil-cuerpo"]:has(".awa") div[id="perfil-rotulo"]').css('background-color','#69A0A2');
  $('div[id="perfil-cuerpo"]:has(".enawene") div[id="perfil-rotulo"]').css('background-color','#919653');
  $('div[id="perfil-cuerpo"]:has(".xapiri") div[id="perfil-rotulo"]').css('background-color','#CEA04B');
  $('div[id="perfil-cuerpo"]:has(".inter") div[id="perfil-rotulo"]').css('background-color','#CE4B4B');
  $('div[id="perfil-cuerpo"]:has(".castel") div[id="perfil-rotulo"]').css('background-color','#8A6763');
  $('div[id="perfil-cuerpo"]:has(".consej") div[id="perfil-rotulo"]').css('background-color','#CB6034');
  $('div[id="perfil-cuerpo"]:has(".cura") div[id="perfil-rotulo"]').css('background-color','#B6C53F');
  $('div[id="perfil-cuerpo"]:has(".adul") div[id="perfil-rotulo"]').css('background-color','#7D637C');
  $('div[id="perfil-cuerpo"]:has(".otro") div[id="perfil-rotulo"]').css('background-color','#878E8E');
});

It's a little hacky, but it should do the trick. o/
avatar
Kyo Panda
Forumember

Male Posts : 33
Reputation : 19
Language : Portuguese, English
Location : Brazil

http://pt.rpgmaker.io

Back to top Go down

Solved Re: Background color postprofile by rank

Post by Sativa on March 30th 2017, 10:29 pm

You are a genious!! Thanks you Solved.
avatar
Sativa
New Member

Female Posts : 11
Reputation : 1
Language : Spanish, English

http://castelobruxorpg.foroactivo.com/

Back to top Go down

Solved Re: Background color postprofile by rank

Post by APE on March 30th 2017, 10:51 pm

Problem solved & topic archived.
Please read our forum rules: ESF General Rules



avatar
APE
Manager
Manager

Male Posts : 10117
Reputation : 944
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum