Javascript 悬停时在页面底部显示广告
我想在我的网站底部显示谷歌广告,但我希望它只在鼠标悬停(或单击)箭头图标时出现。我不知道你是否明白我的意思当鼠标悬停在页面底部的箭头上时,我希望广告从任何地方滑动。 该函数需要哪些JS和CSS代码 我现在的代码: HTMLJavascript 悬停时在页面底部显示广告,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我想在我的网站底部显示谷歌广告,但我希望它只在鼠标悬停(或单击)箭头图标时出现。我不知道你是否明白我的意思当鼠标悬停在页面底部的箭头上时,我希望广告从任何地方滑动。 该函数需要哪些JS和CSS代码 我现在的代码: HTML <div id="footer"> <center><script src="http://fanscity.eu/ads/728x90.js"></script></center> </div> 谢谢
<div id="footer"> <center><script src="http://fanscity.eu/ads/728x90.js"></script></center> </div>
谢谢大家! 我想你需要
更新:
HTML
JS
$(文档).ready(函数(e){
var ishover=假;
$(document).on(“mouseover”,“#footer”,function(){
ishover=true;
}).on(“mouseleave”,“#footer”,function(){
$(this.stop().fadeOut();
ishover=false;
}).on(“鼠标悬停”,“img”,函数(){
$(“#页脚”).stop().fadeIn();
}).on(“mouseleave”,“img”,function(){
如果(!ishover)
$(“#页脚”).stop().fadeIn();
});
});
为arrow贴上标记。@sanki我该怎么做?非常感谢!但我希望在页面底部有一个图像,这样访问者就可以阅读“广告”,所以当他们在图像上悬停时,广告就会出现。我该怎么做?再次感谢是的!但是在我的网站上有些东西不太好用。有什么问题显示广告
或$(“#页脚”).fadeIn()\fadeOut()
?fadeIn()fadeOut()
,正如您在“显示广告”上悬停时看到的那样,淡入闪烁,我不知道您是否理解我的意思
#footer {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
background: rgba(0, 0, 0, 0.69);
padding: 20px;
}
<div id="footer">footer</div>
<img id="img" src="arrow.png"/>
#footer{
display:none;
height:40px;
background-color:#666;
position:absolute;
width:100%;
bottom:0;
left:0
}
#img{
position:absolute;
bottom:0;
right:0
}
<script src="js/jquery-1.9.1.min.js" ></script>
<script type="text/javascript">
$(document).ready(function(e) {
var ishover = false;
$(document).on("mouseover",'#footer',function(){
ishover = true;
}).on("mouseleave",'#footer',function(){
$(this).stop().fadeOut();
ishover = false;
}).on("mouseover",'#img',function(){
$('#footer').stop().fadeIn();
}).on("mouseleave",'#img',function(){
if(!ishover)
$('#footer').stop().fadeIn();
});
});
</script>