广告浮窗功能

14 篇文章 0 订阅
8 篇文章 0 订阅

广告浮窗功能,带隐藏和显示功能

.top_arrow { border: 0 none; bottom: 115px; cursor: pointer; display: block; position: fixed; right: 0px; width: 175px; z-index: 2147483647;}

.top_arrow img.banner{ width:145px; height: 185px;}

.top_arrow .top_arrow_red{ display: none}

页面:

<script src="<%=request.getContextPath()%>/scripts/top_arrow.js" type="text/javascript"></script>
        <div id="top_arrow_banner" class="top_arrow">
           <img src="/images/hide.gif" id="contral" /><a href="<s:property value="@com.ivmall.core.util.ConfigUtil@getString('mnj.home.url', 'http://mnj.ivmall.com.cn')" escape="false"/>/player.html" target="_blank"><img src="/images/trailerMnj.jpg" class="banner"></a>
        </div>
        <div id="top_arrow_banner1" class="top_arrow" style="display: none;right: -70px">
            <img src="/images/show.gif" id="contral2" style="width:22px;height: 185px;" />
        </div>


<script type="text/javascript">
        $("#contral").click("blur",function(){
            $("#top_arrow_banner").css("display","none");
            $("#top_arrow_banner1").css("display","");
            return ;
        });
        $("#contral2").click("blur",function(){
            $("#top_arrow_banner").css("display","");
            $("#top_arrow_banner1").css("display","none");
            return ;
        });

</script>


top_arrow.js

$(document).ready(function(){

//首先将#top_arrow隐藏

    $("#top_arrow").hide();
    $("#top_arrow_banner").show();
//当滚动条的位置处于距顶部100像素以下时,跳转链接出现,否则消失

    $(function () {
        $(window).scroll(function(){
           // $("#top_arrow_banner").hide();
            if ($(window).scrollTop()>100){
                $("#top_arrow").fadeIn(400);
            }
            else
            {
                //$("#top_arrow_banner").show();
                $("#top_arrow").fadeOut(400);
            }
        });

//当点击跳转链接后,回到页面顶部位置

        $("#top_arrow").click(function(){
            $('body,html').animate({scrollTop:0},400);
            return false;
        });
        $("#top_arrow").bind("mouseover",function(){
            $("#top_arrow .top_arrow_gray").hide();
            $("#top_arrow .top_arrow_red").show();
        });
        $("#top_arrow").bind("mouseout",function(){
            $("#top_arrow .top_arrow_gray").show();
            $("#top_arrow .top_arrow_red").hide();
        })
    });
});



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值