文章内容
本文介绍一个jQuery右侧悬浮广告效果可关闭,代码如下
html代码
<script type="text/javascript" src="jquery/3.3.1/jquery.min.js"></script>
<style>
#jqfree
{
position: fixed;
z-index: 99;
top: 0;
right: 0;
padding-top: 100px;
}
#jqfree a
{
position: relative;
display: block;
margin-bottom: 15px;
}
#jqfree a img:first-child
{
position: absolute;
top: 0;
right: 0;
}
</style>
<div id="jqfree">
<a href="#">
<img src="images/close.png">
<img src="images/1.png" style="width: 250px; height: 100px;">
</a><a href="#">
<img src="images/close.png">
<img src="images/1.png" style="width: 250px; height: 100px;">
</a>
</div>
<script type="text/javascript">
$('#jqfree a img:first-child').click(function () {
$(this).parent().hide();
return false;
});
</script>在线演示:演示
