2014-11-08 62 views
0

我想在我的网站底部显示Google广告,但我希望它只在鼠标悬停(或点击)箭头图标时才会显示。我不知道你明白我的意思。 当鼠标悬停在页面底部的箭头时,我希望AD从无处滑动。悬停时在页面底部显示ADS

哪些JS和CSS代码我需要该功能?

我现在代码:

HTML

<div id="footer"> <center><script src="http://fanscity.eu/ads/728x90.js"></script></center> </div> 

CSS

#footer { 
    position: absolute; 
    left: 0; 
    bottom: 0; 
    width: 100%; 
    background: rgba(0, 0, 0, 0.69); 
    padding: 20px; 
} 

谢谢!

+0

发布箭头的标记。 – Jinandra 2014-11-08 16:00:20

+0

@sanki我该怎么做? – 2014-11-08 16:19:44

回答

1

我想你需要this

UPDATE:

HTML

<div id="footer">footer</div> 
<img id="img" src="arrow.png"/> 

CSS

#footer{ 
    display:none; 
    height:40px; 
    background-color:#666; 
    position:absolute; 
    width:100%; 
    bottom:0; 
    left:0 
}  
#img{ 
    position:absolute; 
    bottom:0; 
    right:0 
} 

JS

<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> 
+0

非常感谢!但我希望图像位于页面的底部,因此访问者可以阅读'ADS',因此当他们将图像悬停时,AD会出现。我怎样才能做到这一点?再次感谢 – 2014-11-08 16:52:22

+0

@PLL在美国广播公司:好吧,看看[这](http://jsfiddle.net/ptLx8xhe/2/)可能会有所帮助 – talkhabi 2014-11-08 17:36:47

+0

是的!但是有些东西在我的网站上不能正常工作。 [看](http://danithemes.fanscity.eu/shugar) – 2014-11-08 17:47:03