鼠标在div中隐藏和显示图像 [英] Hiding and displaying an image in mouse over action in a div
本文介绍了鼠标在div中隐藏和显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< div id =consoleonmouseover =$(this).find(' ({display:none}); $(this).find('#offer_image_selected')。css({visibility:visible});
onmouseout =$(this).find('#offer_image')。css({visibility:visible}); $(this).find('#offer_image_selected')。css({display:none}) ; >
但是,当我运行应用程序时它不起作用。任何人都可以指出它出了什么问题吗?如果你使用jQuery尝试
解决方案
pre $ < div id =console
onmouseover =$(this).find('#offer_image')。hide(); $(this).find '#offer_image_selected')显示();。
onmouseout =$(this).find('#offer_image')。show(); $(this).find('#offer_image_selected')。hide();>
它使用 show()
和 hide()
来自jQuery的方法。
否则使用以下内容:
< div id =console
onmouseover =$(this).find('#offer_image')。css('display','none') ; $(this).find('#offer_image_selected').css('display','block');
onmouseout =$(this).find('#offer_image')。css('display','block'); $(this).find('#offer_image_selected')。css('display', '没有'); >
Im trying to hide a specific image in mouse over and display another image. The opposit will be done when mouseout. Below is the code I wrote,
<div id="console" onmouseover="$(this).find('#offer_image').css({display: none});$(this).find('#offer_image_selected').css({visibility: visible});"
onmouseout="$(this).find('#offer_image').css({visibility: visible});$(this).find('#offer_image_selected').css({display: none});" >
But it doesn't work when I run the application. Can anyone point out what has gone wrong in it?
Thanks a lot!
解决方案
If your using jQuery try
<div id="console"
onmouseover="$(this).find('#offer_image').hide(); $(this).find('#offer_image_selected').show();"
onmouseout="$(this).find('#offer_image').show(); $(this).find('#offer_image_selected').hide();">
This uses show()
and hide()
methods from jQuery.
Otherwise use the following:
<div id="console"
onmouseover="$(this).find('#offer_image').css('display', 'none'); $(this).find('#offer_image_selected').css('display', 'block');"
onmouseout="$(this).find('#offer_image').css('display', 'block'); $(this).find('#offer_image_selected').css('display', 'none');" >
这篇关于鼠标在div中隐藏和显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文