Reputation: 15
This should be pretty self explanatory, any help much appreciated!
Jquery Code
$("#larrow img").hide();
$("#rarrow img").hide();
$("#rarrow").hover(arrowIn,arrowOut);
$("#larrow").hover(arrowIn,arrowOut);
function arrowIn()
{
$(this+" img").show()
}
function arrowOut()
{
$(this+" img").hide()
}
I also tried this with the img as the background
$("#larrow").css('visibility','hidden');
$("#rarrow").css('visibility','hidden');
$("#rarrow").hover(arrowIn,arrowOut);
$("#larrow").hover(arrowIn,arrowOut);
function arrowIn()
{
$(this).css('visibility','visible')
}
function arrowOut()
{
$(this).css('visibility','hidden')
}
obviously to no avail, thanks for help in advance!
Upvotes: 1
Views: 222
Reputation: 145398
You cannot concatenate this
with img
selector. Anyway, this code may be shorter:
function arrow() {
$("img", this).toggle();
}
$("#larrow img, #rarrow img").hide();
$("#rarrow, #larrow").hover(arrow);
DEMO: http://jsfiddle.net/4fHL3/
Upvotes: 2
Reputation: 18339
Since you didn't post the Html you can try this:
function arrowIn()
{
$(this).show();
}
function arrowOut()
{
$(this).hide();
}
OR
function arrowIn()
{
$('img', this).show();
}
function arrowOut()
{
$('img', this).hide();
}
Upvotes: 1