etidd
June 10, 2011, 5:15pm
1
Hello everyone,
I’m trying to change the font color upon hovering of my CSS ID’s #realmaturesingles and #seniorpeoplemeet . How do I do this using JavaScript? :sick:This is what I’ve tried.
<script type="text/javascript">
$('#seniorpeoplemeet').FontEffect({
gradient:true,
mirror:true,
mirrorColor:"#CCC"
})
$('#realmaturesingles').FontEffect({
gradient:true,
mirror:true,
mirrorColor:"#CCC"
})
function seniorPeopleMeetInitial()
{
$('#seniorpeoplemeet').FontEffect({
gradient:true,
mirror:true,
mirrorColor:"#CCC"
})
}
function realMatureSinglesInitial()
{
$('#realmaturesingles').FontEffect({
gradient:true,
mirror:true,
mirrorColor:"#CCC"
})
}
function seniorPeopleMeetChange()
{
$(this).find("#seniorpeoplemeet").css('color', '#666');
}
function realMatureSinglesChange()
{
$(this).find("#realmaturesingles").css("color", '#666');
}
$("#realmaturesingles").hover(realMatureSinglesChange(), realMatureSinglesInitial());
$("#seniorpeoplemeet").hover(seniorPeopleMeetChange(), seniorPeopleMeetInitial());
</script>
(:
force
June 10, 2011, 5:36pm
2
What does your HTML look like?
You could probably do this with CSS instead by using the :hover selector.
:hover (CSS selector)
etidd
June 10, 2011, 5:47pm
3
<div style="padding-bottom:5%;"><a href="http://www.atlantareviewgroup.com/dating/seniorpeoplemeetreview1.php" id="seniorpeoplemeet" style="width:50em; padding-right:3em;">Senior People Meet</a></div>
I should do it not only in CSS, but in JavaScript, too, for multi-browser compatibility, right?
force
June 10, 2011, 5:57pm
4
etidd:
<div style="padding-bottom:5%;"><a href="http://www.atlantareviewgroup.com/dating/seniorpeoplemeetreview1.php" id="seniorpeoplemeet" style="width:50em; padding-right:3em;">Senior People Meet</a></div>
I should do it not only in CSS, but in JavaScript, too, for multi-browser compatibility, right?
Nope. All you need is CSS.
Granted, IE doesn’t support the :hover selector for all HTML elements beyond the <a> tag, but you can add in a .htc behavior file to address the deficiency.
etidd
June 10, 2011, 6:08pm
5
I would like to learn this in JavaScript just so I get some practice with JavaScript. Will you still help me?