如果你使用 jQuery 库,这将非常容易。
假设您有以下 id="footer" 且具有自定义样式的页脚 div
<div id="footer" style="position:fixed;bottom:0px;left:0px;margin:0px;width:100%;opacity:0.001">
<center>StackOverflow | About US | Privacy | Blah Blah Blah | Something </center>
</div>
Run Code Online (Sandbox Code Playgroud)
然后添加以下java脚本
<script type="text/javascript">
$(document).ready(function() {
$('#footer').hover(
function(){
$(this).stop().fadeTo('slow',1);
},
function(){
$(this).stop().fadeTo('slow',0.001);
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
确保您已包含 jQuery 库,如果没有,只需将以下行添加到 Head 部分:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
705 次 |
| 最近记录: |