jQuery实现页面滚动时层智能浮动定位

news/2024/7/10 23:58:00 标签: jquery, function, class, border, float, div
class="baidu_pl"> <div id="article_content" class="article_content clearfix"> <div id="content_views" class="htmledit_views">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery实现页面滚动时层智能浮动定位小插件</title>
<style type="text/css">
*{ margin:0; padding:0;}
body { font:12px/1.8 Arial; color:#666;}
h1.tit-h1 { font-size:38px; text-align:center; margin:30px 0 15px; color:#f60;}
.go-back{ text-align:center; border-top:1px dashed #ccc; padding:10px; margin-top:20px; font-size:40px;}
.wrap{border:1px dashed #ccc; background:#f8f8f8; padding:20px;}

.demo { height:1500px; }
.float { width:200px; padding:5px 10px; border:1px solid #ffecb0; font-size:12px; background-color:#fffee0; -moz-box-shadow:1px 1px 2px rgba(0,0,0,.2); -webkit-box-shadow:1px 1px 2px rgba(0,0,0,.2); box-shadow:1px 1px 2px rgba(0,0,0,.2); position:absolute; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; }
.float .close-ico{ position:absolute; top:5px; right:5px; display:block; width:16px; height:16px; }
</style>
<script type="text/javascript" src="
http://www.lizhoumin.com/js.js"></script>

</head>
<body>

<h1 class="tit-h1">jQuery实现页面滚动时层智能浮动定位</h1>
<div style="width:960px; margin:0 auto;"><p style="font-size:20px; color:#f00; background:#000; color:#fff; text-align:center; font-weight:800;">与别人分享快乐,你的快乐就会加倍,与别人分担痛苦,你的痛苦就会减半。</p></div>

<div class="wrap">
<script type="text/javascript">
(class="tags" href="/tags/FUNCTION.html" title=function>function($){
    $.fn.capacityFixed = class="tags" href="/tags/FUNCTION.html" title=function>function(options) {
        var opts = $.extend({},$.fn.capacityFixed.deflunt,options);
        var FixedFun = class="tags" href="/tags/FUNCTION.html" title=function>function(element) {
            var top = opts.top;
            var right = ($(window).width()-opts.pageWidth)/2+opts.right;
            element.css({
                "right":right,
                "top":top
            });
            $(window).resize(class="tags" href="/tags/FUNCTION.html" title=function>function(){
                var right = ($(window).width()-opts.pageWidth)/2+opts.right;
                element.css({
                    "right":right
                });
            });
            $(window).scroll(class="tags" href="/tags/FUNCTION.html" title=function>function() {
                var scrolls = $(this).scrollTop();
                if (scrolls > top) {

                    if (window.XMLHttpRequest) {
                        element.css({
                            position: "fixed",
                            top: 0       
                        });
                    } else {
                        element.css({
                            top: scrolls
                        });
                    }
                }else {
                    element.css({
                        position: "absolute",
                        top: top
                    });
                }
            });
            element.find(".close-ico").click(class="tags" href="/tags/FUNCTION.html" title=function>function(event){
                element.remove();
                event.preventDefault();
            })
        };
        return $(this).each(class="tags" href="/tags/FUNCTION.html" title=function>function() {
            FixedFun($(this));
        });
    };
    $.fn.capacityFixed.deflunt={
  right : 100,//相对于页面宽度的右边定位
        top:150,
        pageWidth : 960
 };
})(jQuery);
</script>


<div class="float" id="float">
    <p>1条新私信,<a href="
http://www.lizhoumin.com/">查看私信</a></p>
    <p>10条新消息,<a href="
http://www.lizhoumin.com/">查看消息</a></p>
    <p>108个新粉丝,<a href="
http://www.lizhoumin.com/">查看粉丝</a></p>
<a href="#" title="关闭" id=""  class="close-ico">关闭</a>

</div>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>

<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>

<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>

<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>

<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<p>哥是来占位的</p>
<script  type="text/javascript">
$("#float").capacityFixed();
</script>
   
</div>
<div style="height:500px;"></div>
</body>
</html>

div> div> <div id="treeSkill">div>

http://www.niftyadmin.cn/n/925495.html

相关文章

Establishing SSL connection without server identity verification is not recommended

报错 SpringBoot启动时报错&#xff1a; Wed Jun 17 10:13:14 CST 2020 WARN: Establishing SSL connection without servers identity verification is not recommended. According to MySQL 5.5.45, 5.6.26 and 5.7.6 requirements SSL connection must be established by …

Idea 多线程断点被跳过

多线程调试时候出现 解决 在&#xff0c;打断点的时候&#xff0c;将ALL选为Thread

验证大全

转换标准时间 public static string getSubDatetime(object obj) { string Result string.Empty; if (obj ! null) { DateTime dt; if (DateTime.TryParse(obj.ToString(), out dt)) { dt …

线上服务启动卡死,堆栈分析

背景 服务启动时候会从mysql加载数据到es中,测试环境正常,线上异常卡住,不动。 查看堆栈信息 关键点 "elasticsearch[_client_][generic][T#5]" #843 daemon prio=5 os_prio=0 tid=0x00007fb3ec007000 nid=0x601b waiting on condition [0x00007fb1b5596000]ja…

组织机构代码验证

/// <summary>/// 验证是否是合法 /// </summary>/// <param name"Code"></param>/// <returns></returns>public static bool IsRegCode(string Code){bool flag true;if (Code.Length10){string left Code.Substring(0, 8);…

Elasticsearch中什么是 tokenizer、analyzer、filter ?

文章目录 Tokenizers(分词器)Token Filters(字符过滤器)Analyzer(分析器)自定义Analyzer带有停用词和同义词的分析器带有除梗和停用词的分析器3)带有特殊符号映射为特定单词的分析器Elastic search 是一个能快速帮忙建立起搜索功能的,最好之一的引擎。 搜索引擎的构建模块…

Gridview导出到Excel

#region #导出到Excelprotected void Button2_Click(object sender, EventArgs e){Response.ClearContent();Response.AddHeader("content-disposition", "attachment;filenameMyExcelFile.xls");Response.ContentType "application/excel";Str…

ElasticSearch Snowball token filter

Snowball token filter 使用除梗器,对单词进行除梗的过滤器。语言参数可以控制除梗器,有如下的语言可供选择: Armenian, Basque, Catalan, Danish, Dutch, English, Finnish, French, German, German2, Hungarian, Italian, Kp, Lithuanian, Lovins, Norwegian, Porter, Por…