jQuery js 广告延迟加载 支持 百度 Google 淘宝 等广告

jQuery js 广告延迟加载 支持 百度 Google 淘宝 等广告

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery 广告延迟加载 支持 百度 Google 淘宝 等广告</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"  media="all"></script>
<script type="text/javascript" src="jquery.ad.js"  media="all"></script>
</head>
<body>

<h1>请自己修改广告id等 否则是不显示广告的</h1>
<div id="google"><h3>Google 的广告</h3><br/><br/></div>
<div id="baidu"><h3>Baidu 的广告</h3><br/><br/></div>
<div id="taobao"><h3>Taobao 的广告</h3><br/><br/></div>
<div id="sogou"><h3>Sogou 的广告</h3><br/><br/></div>


<script type="text/javascript">
$(function(){
    // Google 的
    $('#google').ad('http://pagead2.googlesyndication.com/pagead/show_ads.js', function(){
        google_ad_client = "pub-12312312312";
        google_ad_slot = "12312312";
        google_ad_width = 728;
        google_ad_height = 90;
    });

    // 百度的
    $('#baidu').ad('http://cpro.baidu.com/cpro/ui/c.js',function(){
        window.cpro_id = 'u123';
    });

    // 淘宝的
    $('#taobao').ad('http://a.alimama.cn/inf.js',function(){
        alimama_pid="mm_123_123_123";
        alimama_width=336;
        alimama_height=280;
    });
       
    // 搜狗的
    $('#sogou').ad('http://images.sohu.com/cs/jsfile/js/c.js',function(){
        window.sogou_ad_id=123;
        window.sogou_ad_height=60;
        window.sogou_ad_width=468;
    });

})
</script>


</body>
</html>

代码下载

本文代码下载:ad.zip

备用下载:/ad.zip

Leave a Reply

You must be logged in to post a comment.

RSS feed for comments on this post. TrackBack URL