john_yourspace
asked on
Jquery Image Swap
Hi guys,
I have the following structure
I am adding my listener to panel
I am trying to hide the image on mouse over and restore on mouse out, it dont seem to like the selector - any suggestions
John
I have the following structure
<div class="right-col">
<div class="panel crisispregancy">
<h1 class="homepage"><a href="<?php echo get_permalink(21)?>">Crisis Help</a></h1>
<div class="panel_arrow"><a href="<?php echo get_permalink(21)?>"><img src="<?php bloginfo('template_directory'); ?>/images/arrow_homepage_panel.png" alt="go" width="30" height="36"/></a></div>
<img src="<?php bloginfo('template_directory'); ?>/images/crisispreg_imag.jpg" alt="Crisis Pregnancy" width="225" height="172" class="panel_image" />
</div>
<div class="panel education">
<h1 class="homepage"><a href="<?php echo get_permalink(22)?>">Education</a></h1>
<div class="panel_arrow"><a href="<?php echo get_permalink(22)?>"><img src="<?php bloginfo('template_directory'); ?>/images/arrow_homepage_panel.png" alt="go" width="30" height="36" /></a></div>
<img src="<?php bloginfo('template_directory'); ?>/images/sexeducation_image.jpg" alt="Sex Education" width="225" height="172" class="panel_image" />
</div>
<div class="panel publications">
<h1 class="homepage"><a href="<?php echo get_permalink(23)?>">Publications</a></h1>
<div class="panel_arrow"><a href="<?php echo get_permalink(23)?>"><img src="<?php bloginfo('template_directory'); ?>/images/arrow_homepage_panel.png" alt="go" width="30" height="36" /></a></div>
<img src="<?php bloginfo('template_directory'); ?>/images/publications_img.jpg" alt="Publications" width="225" height="172" class="panel_image" />
</div>
</div>
I am adding my listener to panel
<script>
$(function() {
$(".panel")
.mouseover(function() {
$(this).next('.panel_image').hide();
})
.mouseout(function() {
console.log("out");
});
});
</script>
I am trying to hide the image on mouse over and restore on mouse out, it dont seem to like the selector - any suggestions
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the idea, I used this in the end
<script language="javascript" type="application/javascri pt">
$(function() {
$(".panel")
.mouseover(function() {
$('.panel_image',this).hid e();
$('.panel_text',this).show ();
$('.bottomPanelImage',this ).hide();
})
.mouseout(function() {
$('.panel_text',this).hide ();
$('.panel_image',this).sho w();
$('.bottomPanelImage',this ).show();
});
});
</script>
<script language="javascript" type="application/javascri
$(function() {
$(".panel")
.mouseover(function() {
$('.panel_image',this).hid
$('.panel_text',this).show
$('.bottomPanelImage',this
})
.mouseout(function() {
$('.panel_text',this).hide
$('.panel_image',this).sho
$('.bottomPanelImage',this
});
});
</script>
on mouse over:-
Open in new window
on mouse out:-
Open in new window