Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
70
rated 0 times [  76] [ 6]  / answers: 1 / hits: 23426  / 9 Years ago, sat, october 3, 2015, 12:00:00

on this page i have the first div as a dark image and the second as a light background.



i want the sidebar text color to be light on the dark image and dark on the light.



how would i set the color according to what div is in the background? just need it for two color options.



this is another example of what I'm looking for http://www.acnestudios.com/
example html:



 <div id=home_wrapper>
<div id=home_top_t_wrap> <!-- DARK BACKGROUND -->
<h1 class=top_text_h1> Shop New York Like Never Before </h1> <!-- TEXT THAT NEEDS TO GO FROM LIGHT TO DARK --> </div>
<div id=the_market_container> <!-- LIGHT BACKGROUND --></div>
</div>

More From » jquery

 Answers
49
<div id=home_wrapper>
<div id=home_top_t_wrap> <!-- DARK BACKGROUND -->
<h1 class=top_text_h1> Shop New York Like Never Before </h1> <!-- TEXT THAT NEEDS TO GO FROM LIGHT TO DARK --> </div>
<div id=the_market_container> <!-- LIGHT BACKGROUND --></div>
</div>


<script>

$(document).ready(function() {
$(#home_top_t_wrap).hover(function() {
$(body).css(background-color,light); //change light to your color
});
$(#the_market_container).hover(function() {
$(body).css(background-color,dark); //change dark to your color
});

});
</script>


I tried on div hover. Hope this helps


[#64847] Thursday, October 1, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
erick

Total Points: 588
Total Questions: 92
Total Answers: 100

Location: Bangladesh
Member since Sat, Jan 23, 2021
3 Years ago
;