js和jquery获取文档对象以及滚动条位置【上海时时

});

        $(window).scroll(function () {

     var window_w = $(window).width();
     if(window_w>1000){duilian.show();}
     $(window).scroll(function(){
         var scrollTop = $(window).scrollTop();
         duilian.stop().animate({top:scrollTop 100});
     });
     duilian_close.click(function(){
         $(this).parent().hide();
         return false;
     });
});
</script>
<style>
/*上面是对联广告的css代码*/
.duilian{top:100px;position:absolute; width:102px; overflow:hidden; display:none;}
.duilian_left{ left:6px;}
.duilian_right{right:6px;}
.duilian_con{border:red solid 1px; width:100px; height:300px; overflow:hidden;}
.duilian_close{ width:100%; height:24px; line-height:24px; text-align:center; display:block; font-size:13px; color:#555555; text-decoration:none;}
</style>
</head>
<body>
<!--下边是对联广告的html代码结构-->
<div class="duilian duilian_left">
     <div class="duilian_con">对联的开始和结果</div>
     <a href="#" class="duilian_close">X关闭</a>
</div>
<div class="duilian duilian_right">
     <div class="duilian_con">对联的原委</div>
     <a href="#" class="duilian_close">X关闭</a>
</div>
<p style="height:1000px;"></p>
</body>
</html>

<div style="overflow: hidden;position: fixed;right: 10px;bottom: 20px;z-index: 10;">
<div style="overflow: hidden;">
<div style="padding-top:20px;padding-right:50px;padding-bottom:50px;">
<a href="#" style="float: right;display:none" class="btns maoDian" id="goToTop" >回到顶端</a>
</div>
</div>
</div>

        })
    });

企望本文所述对我们的jQuery程序设计有所支持。

<!--JSP写入 回到顶端--!>

        var dWidth = document.body.offsetWidth;  //纯javascript整个页面文书档案的大幅度
        var hHeight = document.body.offsetHeight;   //纯javascript整个页面文书档案的莫斯中国科学技术大学学
        var scrollTop = document.body.scrollTop document.documentElement.scrollTop
        alert(" docWidth: " dWidth " docHeight: " hHeight " : "

本文实例叙述了jquery完结对联广告的秘诀。分享给大家供我们参照他事他说加以考察。具体达成格局如下:

 

        <div style="width:120px;height:120px;border:1px solid red; position:absolute; left:800px; top:100px; z-index:1001;" id="AdminUserStateDiv">
        
        </div>
        <div class="div1">层1</div>
<div class="div2">层2</div>
   <style type="text/css">
        .div1{
   
    width:2000px;
    height:2000px;
    }

复制代码 代码如下:

$('#goToTop a').click(function(){
$('html,body').animate({scrollTop:0},'slow');
});

        $(".suggest").css("left", offleft "px");
        setTimeout($(".suggest").css("display", "block"), 10);
        $("#back-to-top").css("left", offleft "px");
        $("#myClose").css("left", offleft "px");

<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
     var duilian = $("div.duilian");
     var duilian_close = $("a.duilian_close");

//当点击跳转链接后,回到页面最上端地点

        //var offleft = width-47; //(width-990)/2 990;

您或者感兴趣的稿子:

  • jquery达成两侧飘浮可关闭的对联广告
  • jQuery网页左边广告跟随滚动代码分享
  • jquery达成可关闭的倒计时广告特效代码
  • jquery完成滑屏大图按时收缩为小banner图片的广告代码
  • jquery右下角自动掸出可关闭的广告层
  • jQuery落成首页顶端可伸缩广告特效代码
  • 据书上说jquery达成的定期显示与遮盖div广告的达成代码
  • 基于jquery达成图片广告轮换效果代码
  • jQuery 浮动广告完成代码
  • jQuery完毕页面最上端下拉广告

 

            var AdminUserStateDiv = $("#AdminUserStateDiv");
            //AdminUserStateDiv.css("top", scrollTop "px");
            AdminUserStateDiv.animate({ "top": scrollTop "px" }, 0);
            //$("#scrollUl").animate({ "marginLeft": scrollposition "px" }, 10);

<!--js写入--!>

</script>

$(function(){

//                //$(".suggest").css("left",offleft "px");

//当滚动条的岗位处于距最上端100像素以下时,跳转链接出现,不然消失
$(function () {
$(window).scroll(function(){
if ($(window).scrollTop()>100){
$("#goToTop").fadeIn();
}
else
{
$("#goToTop").fadeOut();
}
});

//            if ($.browser.msie && ($.browser.version == "6.0")) {
//                var y = $(window).scrollTop() 400;
//                var backToY = y 80;
//                $("#back-to-top").css("top", backToY "px");
//                $("#myClose").css("top", y "px");
//            }

})

        /****/
        //alert("left4");

    .div2{
    background-color:#33FF66;
    width:100px;
    height:100px;
    position:fixed;
    left:50px;
    top:50px;
    }
    </style>

<script type="text/javascript">
    //当滚动条的岗位处于距最上部100像素以下时,跳转链接出现,不然消失

            var scrollTop = $(document).scrollTop();
            //alert(scrollTop);

        alert("docWidth: " docWidth "——" "docHeight:" docHeight

//                $("#back-to-top").fadeIn(500);
//                //$(".suggest").fadeIn(500);
//            } else {
//                $("#back-to-top").fadeOut(500);
//                //$(".suggest").fadeOut(500);
//            }

<script type="text/javascript">

    }
    $(document).ready(function () {

    var showAdminUser = function (obj) {
        var offSet = $(obj).offset();
        var docTop = offSet.top;    //当前因素相对文书档案top偏移地方
        var docLeft = offSet.left;  //当前因素相对文档left偏移地方

    $(document).ready(function () {

//        $(window).scroll(function () {
//            //alert("java");/****/
//            if ($(window).scrollTop() > 100) {
//                //width = $(document).width();
//                //alert("widt:" width);
//                //offleft = width-40; //(width-990)/2 990; //25是报告意见框的宽度

  • scrollTop);

        $.ajax({
            url: "/System/DetailSaleInfoState",
            async: true,
            data: { id: id, enableid: optVal },
            type: "Post",
            dataType: "json",
            beforeSend: function () {
            },
            success: function (dataT) {
                alert(dataT.message);
            },
            error: function (er) {
                alert(er);
            }

//        });
        //当点击跳转链接后,回到页面顶端地点
        $("#back-to-top").click(function () {
            $('body,html').animate({ scrollTop: 0 }, 100);
            return false;
        });
    });
    /****/
</script>
<!--回到最上端完工-->

    var UpdateSaleEnable = function (sel) {
        var optVal = $(sel).val();
        var id = $(sel).attr("id").split('_')[js和jquery获取文档对象以及滚动条位置【上海时时乐走势图官网】。1];
        // alert(optVal "--------" id);
        //        $.ajax({
        //            type: 'post',
        //            url: "/System/DetailSaleInfoState", //Controller和action地址
        //            data: 'id=' id '&enableid=' optVal, //参数
        //            success: function (data) {
        //                alert(data.message); //confirm
        //            },
        //            error: function (err) { alert(Promotions.messages.yichangcuowu); }
        //        });

    var width = $(document).width();
    //alert("widt:" width);

        });

<style type="text/css">
#back-to-top{height:24px}
p#back-to-top a span{margin-bottom:2px;}
p#back-to-top a span {border-radius:0;}
</style>
<div class="suggest" style="position:fixed; height:104px; bottom:100px; float:left; display:none; ">
    <div class="suggestLeft" style="float:left;">
        <p  flag='0' id='myClose' style="display:block;left: 1126.5px; ">
            <a href="javascript:showAdvice();">
            <span style=" background:url('') no-repeat scroll 0px 0px; display:block; height:60px;line-height: 14px;overflow: hidden;width:23px;float:left;padding:20px 0 0 2px;color: #FF6600;text-align: center;text-decoration: none">意见反馈</span>
            </a>
        </p>
js和jquery获取文档对象以及滚动条位置【上海时时乐走势图官网】。        <p id="back-to-top" >
            <a href="#top">
            <span  style="background:url('') no-repeat scroll -25px -80px; display:block; height: 24px;overflow: hidden;padding-top:0;width:25px">
            </span>
            </a>
        </p>
    </div>
</div>

        var docWidth = $(document).width(); //整个页面文档的幅度
        var docHeight = $(document).height();   //整个页面文书档案的惊人
        var dScrollTop = $(document).scrollTop(); //整个文书档案滚动条相对top地点
        var wScrollTop = $(window).scrollTop(); //整个荧屏滚动条相对top地点
        var winWidth = $(window).width(); //整个显示器宽度
        var winHeight = $(window).height();//整个显示器中度

    }

    var offleft = width - 26;
    if ($.browser.msie && ($.browser.version == "6.0")) {
        //alert("ie6");
        $("#back-to-top").css("position", "absolute");
        $("#myClose").css("position", "absolute");
    }
    if ($.browser.msie) {
        offleft = width - 47;
    }

  • " dScrollTop:" dScrollTop);

本文由上海时时乐走势图发布于web前端,转载请注明出处:js和jquery获取文档对象以及滚动条位置【上海时时

您可能还会对下面的文章感兴趣: