带关闭按钮的跟随窗口移动对联广告代码

http://www.xuecss3.com/qttx-25-2991-1.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery制作对联广告悬浮特效跟随滚动条滚动-学css3网</title>
<meta name="description" content="jquery图片广告制作一个侧面浮动图片广告特效,类似滚屏效果的图片广告。jQuery下载。" />
</head>

<body>

<style type="text/css">
*{margin:0;padding:0;list-style-type:none;}
.fixediv{position:fixed;top:140px;z-index:9999;width:140px;height:216px;background:#ddd;}
.fixediv img{float:left;}
.fixediv a.close{display:block;height:30px;line-height:30px;background:#fff;font-size:14px;padding:0 10px;color:#5e5e5e;text-decoration:none;text-align:center;}
.leftadv{left:0px;}
.rightadv{right:0px;}
</style>

<div class="fixediv leftadv">
    <a href="http://www.xuecss3.com/"><img src="images/180.jpg" width="140" height="186" alt="性感美女" /></a>
    <a class="close" href="javascript:void(0);">关闭广告</a>
</div>

<div class="fixediv rightadv">
    <a href="http://www.xuecss3.com/"><img src="images/280.jpg" width="140" height="186" alt="清纯美女" /></a>
    <a class="close" href="javascript:void(0);">关闭广告</a>
</div>

<div style="height:1200px;"></div>

<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){

    $(".fixediv a").click(function(){

        $(".fixediv").fadeOut(400);

    });

    $(".fixediv").floatadv();

});

jQuery.fn.floatadv = function(loaded) {
    var obj = this;
    body_height = parseInt($(window).height());
    block_height = parseInt(obj.height());

    top_position = parseInt((body_height/2) - (block_height/2) + $(window).scrollTop());
    if (body_height<block_height) { top_position = 0 + $(window).scrollTop(); };

    if(!loaded) {
        obj.css({‘position‘: ‘absolute‘});
        obj.css({ ‘top‘: top_position });
        $(window).bind(‘resize‘, function() {
            obj.floatadv(!loaded);
        });
        $(window).bind(‘scroll‘, function() {
            obj.floatadv(!loaded);
        });
    } else {
        obj.stop();
        obj.css({‘position‘: ‘absolute‘});
        obj.animate({ ‘top‘: top_position }, 400, ‘linear‘);
    }
}
</script>

</body>
</html>
时间: 2024-10-13 04:26:58

带关闭按钮的跟随窗口移动对联广告代码的相关文章

可关闭与展开的对联广告代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-

蓝色经典的对联广告代码

<html><head><title>蓝色经典的对联广告代码</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><body><table><tr><td height="1000"></tr></t

js对联广告代码,兼容性高

var browser = { ie6: function () { return ((window.XMLHttpRequest == undefined) && (ActiveXObject != undefined)) }, getWindow: function () { var myHeight = 0; var myWidth = 0; if (typeof (window.innerWidth) == 'number') { myHeight = window.innerHe

JS带关闭按钮的网页漂浮广告代码

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>带关闭按钮的网页漂浮广告代码</title> </head> <body> <div id="img" style="position: absolute; left: 

JS写出登陆遮罩层+浮动对联广告

用JS写出 遮罩层登陆框 和 对联广告 并自动跟随滚动条 滚动 保持让用户一直可以看到 好了,天色已晚废话不多说,代码特别详细 有注释,请看代码. ================> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xml

JQuery对联广告

html--------------------------------------------------------------------------------------<!DOCTYPE html><html><head> <meta charset="UTF-8"> <script src="../js/jquery-3.2.1.min.js"></script> <link

Android带返回值的窗口跳转

1.AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.fish.helloworld" android:versionCode="1" android:vers

我们这里有仿百度联盟对联广告实现代码

仿百度联盟对联广告源代码展示,主要使用现代浏览器都支持的position:fixed属性,并专门针对ie6做了最大限度的兼容性处理 <style type="text/css"> 02 *{margin:0;padding:0;} 03 body{height:2000px;} 04 .floatAd{width:124px;height:299px; text-align:center; position:fixed;margin-left:0;top:109px; _p

无法屏蔽的左右漂浮图片对联广告

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>无法屏蔽的左右漂浮图片对联广告丨河北塑胶地