请编辑 Javascript 以添加淡入/淡出效果
是否可以在此 javascript 中添加淡入淡出效果?目前,它只是在第一个 div 悬停时将图像加载到另一个 div,但没有任何效果。提前致谢。
<script language="javascript" type="text/javascript">
function changeDisplay(bgImageURL)
{
var displayDiv = document.getElementById("displayDiv");
// draw popup image in the div
displayDiv.innerHTML =
'<a class="popup1" href="#v"><img src="' + bgImageURL+ '" alt="" /></a>';
// show the display in case it was hidden before
displayDiv.style.visibility = "visible";
}
function hideDisplay()
{
var displayDiv = document.getElementById("displayDiv");
// hide it when the mouse rolls off the thumbnail
displayDiv.style.visibility = "hidden";
}
</script>
Is it possible to add a fade in fade out effect to this javascript? At the moment it just loads an image to another div upon hover of first div but with no effect. Thanks in advance.
<script language="javascript" type="text/javascript">
function changeDisplay(bgImageURL)
{
var displayDiv = document.getElementById("displayDiv");
// draw popup image in the div
displayDiv.innerHTML =
'<a class="popup1" href="#v"><img src="' + bgImageURL+ '" alt="" /></a>';
// show the display in case it was hidden before
displayDiv.style.visibility = "visible";
}
function hideDisplay()
{
var displayDiv = document.getElementById("displayDiv");
// hide it when the mouse rolls off the thumbnail
displayDiv.style.visibility = "hidden";
}
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 jQuery
http://api.jquery.com/fadeIn/
fadeOut
: http://api.jquery.com/fadeOut/Using jQuery
http://api.jquery.com/fadeIn/
fadeOut
: http://api.jquery.com/fadeOut/简单改变你现有的代码
显示功能
隐藏功能
simple change in your existing code
display function
hide function