Fork me on GitHub

我的随笔

OmniGraffle导入stencils的两个方法以及优质的stencils下载网站推荐 馬小妹 2017-05-16 15:11 阅读:11580 评论:1 推荐:3   
社会性动物(艾略特•阿伦森) 馬小妹 2017-03-10 18:12 阅读:2751 评论:0 推荐:0   
MacTex 在XeLaTex编译状态下插入的pdf格式图片无法显示问题的解决方案 馬小妹 2017-03-10 15:33 阅读:1661 评论:0 推荐:0   
Markdown,别来无恙! 馬小妹 2017-03-01 23:19 阅读:282 评论:0 推荐:0   
男人来自火星 女人来自金星(约翰·格雷) 馬小妹 2017-02-22 19:28 阅读:1319 评论:0 推荐:0   
沟通的艺术(罗纳德·B·阿德勒/拉塞尔·F·普罗科特) 馬小妹 2017-02-04 11:34 阅读:10031 评论:0 推荐:1   
精进——如何成为很厉害的人(采铜) 馬小妹 2017-01-27 14:03 阅读:1705 评论:0 推荐:0   
腾讯课堂产品经理十天充电计划学习总结 馬小妹 2017-01-23 12:24 阅读:508 评论:0 推荐:0   
如何阅读一本书([美] 莫提默·J. 艾德勒 / 查尔斯·范多伦 ) 馬小妹 2017-01-09 16:10 阅读:705 评论:0 推荐:0   

/* * 功能: 创建一个可以让页面滚动到顶部的按钮, 常见于各种社交网站的微博列表. * 备注: DOM被设置成了浮动的, 用户可以自己设定位置, 传入right, bottom参数即可 还可以配置滚到条到多高的时候会显示插件图标. */ (function ($) { $.fn.scrolltop = function (options) { var opts = $.extend({}, $.fn.scrolltop.defaults, options); var run2top = function () { var scrollDist = $(window).scrollTop(); if (scrollDist > 0) { scrollDist -= opts.topSpeed; scrollDist = Math.max(scrollDist, 0); $(window).scrollTop(scrollDist); setTimeout(run2top, 1); } }; return this.each(function () { var $this = $(this); $this.css("opacity", "0.3"); $this.css("background", "url('u=4251301862,936291425&fm=214&gp=0.jpg') no-repeat"); $this.css("width", opts.width); $this.css("height", opts.height); $this.css("position", "fixed"); $this.css("right", opts.right); $this.css("bottom", opts.bottom); $this.hover( function () { $(this).css('opacity', '1.0'); }, function () { $(this).css('opacity', '0.5'); } ); $this.click(function () { //$(window).scrollTop(0); run2top(); }); $(window).scroll(function () { var scrollDist = $(window).scrollTop(); if (scrollDist >= opts.heightThreshhold) { //当滚动条离顶部超过阈值的时候, 就显示 $this.css("display", "block"); } else { $this.css("display", "none"); } }); }); }; $.fn.scrolltop.defaults = { heightThreshhold: 1000, width: "50px", height: "50px", right: "8%", bottom: "30px", topSpeed: 50 }; })(jQuery);