-1

I'm having some post in php, my table is configuring like this:

while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) {
    $id = $row['id'];
    $title1 = $row['title1'];
    $thumb = $row['thumb'];
    $link = $row['link'];
    $hex = $row['hex'];
    $archiveID= $row['archiveID'];
    $recordListingID= $row['recordListingID'];
    ?>

With that, each item have a specific image, color, etc

Which I display int he front-end like that:

<div id="artist-image">
<img src="<?php echo $thumb ?>"></img>         
</div></a></li>
<?php
}
?>  

On hover a title, the image of the post display, using jquery:

$('#artistlistdesktop ul li a').hover(function(){
      $(this).children('#artist-image').toggleClass('active');|

It's all working fine, but what I'm trying to achieve is on hover a title, to change the color of the title with the hex color assign previously in php via $hex = $row['hex'];

I tried the following css:

#artistlistdesktop li > a:hover{
  color:#<?=$hex?>;;
}

but it's changing into the same color to all the list instead of the color assign.

Do you know how can I achieve this?

----EDIT ----

original color is light grey which is this css:

#artistlistdesktop li > a {
display: block;
text-decoration: none;
font-family: Arial Black, Arial, Helvetica, sans-serif;
color: rgba(146,146,146,0.5);
font-weight: bolder;
line-height: 35px;
font-size: 53px;
letter-spacing: -5px;
padding: 0;
margin: 0;

}

--EDIT 2 --

I got it via:

<li><a onMouseOver="this.style.color='#<?php  echo $hex ?>'"    
  onMouseOut="this.style.color='rgba(146,146,146,0.5)'"

id="" target="_blank" href=" ">

thebigE
  • 55
  • 6

2 Answers2

0

You should apply style=":hover{color: #<?=$hex?>;}" in your object !

  • @thebigE it seems you are missing a space before the style attribute – Goran Stoyanov Jun 12 '17 at 09:42
  • @GoranStoyanov not sur to see where ? – thebigE Jun 12 '17 at 09:52
  • This was only a useful remark that I wanted to make. Why is not working you can read here https://stackoverflow.com/questions/1033156/how-to-write-ahover-in-inline-css – Goran Stoyanov Jun 12 '17 at 10:01