分享模板插件精品好资源
现在位置:首页 > 网站设计 > 一个带微博按钮的jquery返回顶部效果代码

一个带微博按钮的jquery返回顶部效果代码

作者:蓝叶 分类:网站设计 时间:2013-10-16 浏览:10652 评论:4

废话不多说了,直接上代码,这是一个带微博按钮的jquery返回顶部效果代码,兼容于IE8、火狐、谷歌以及所有webkit内核浏览器,如你喜欢就请看过预览后自行选择下载,按照说明格式把代码复制到你的网站上面即可,简单易懂。

演示地址:https://lanye.org/demo/Jqweibo/

JQUERY代码部分,复制代码到</head>之前即可。
<script src="http://libs.baidu.com/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
//scrolltotop
$(function(){
        //首先将#back-to-top隐藏
        $("#totop").hide();
        //当滚动条的位置处于距顶部100像素以下时,跳转链接出现,否则消失
        $(function () {
            $(window).scroll(function(){
                if ($(window).scrollTop()>100){
                    $("#totop").fadeIn();
                }
                else
                {
                    $("#totop").fadeOut();
                }
            });
            //当点击跳转链接后,回到页面顶部位置
            $("#totop").click(function(){
                $('body,html').animate({scrollTop:0},500);
                return false;
            });
        });
    }); 
</script>
CSS部分,复制到你网站的CSS样式里面。
#share {position:fixed;_position:absolute;_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight)-34+"px");bottom:34px;left:95%;width:30px;zoom:1;}
#share a{background-image:url(images/share.png); background-repeat:no-repeat; display:block; width:30px; height:30px; margin-bottom:2px; overflow:hidden; text-indent:-999px;-webkit-transition: all 0.2s ease-in-out;-moz-transition: all 0.2s ease-in-out;-o-transition: all 0.2s ease-in-out;-ms-transition: all 0.2s ease-in-out;transition: all 0.2s ease-in-out;}
#share a{}
#share .sina {background-position:0 0; position:absolute; bottom:32px;}
#share a.sina:hover { background-position:-30px 0;}
#share .tencent { background-position:0 -30px; position:absolute; bottom:0;}
#share a.tencent:hover { background-position:-30px -30px;}
#share a#totop{background-position:0 -120px;position:absolute;bottom:64px;cursor:pointer;}
#share a#totop:hover {background-position:-30px -120px;}
html代码部分,修改后复制到</body>代码前。
<div id="share">
<a id="totop" title="">返回顶部</a>
<a href="http://t.qq.com/lanyesorg" target="_blank" class="sina">关注蓝叶新浪微博</a>
<a href="http://t.qq.com/lanyesorg"  target="_blank" class="tencent">关注蓝叶腾讯微博</a>
</div>

免责声明:

本页网址:点击复制分享给朋友吧!

本站分享的一切内容资源如若没有备注,均为蓝叶原创,如需转载请注明出处;如有侵权请与我们联系处理。敬请谅解!

评论列表
挤眼亲亲咆哮开心想想可怜糗大了委屈哈哈小声点右哼哼左哼哼疑问坏笑赚钱啦悲伤耍酷勾引厉害握手耶嘻嘻害羞鼓掌馋嘴抓狂抱抱围观威武给力
提交评论

清空信息
关闭评论
懒鱼
懒鱼游客
#4
这个效果不错,收走了,呵呵
2013-11-29 09:43回复
独特优惠码
独特优惠码游客
#3
代码字体太小啦,我都是复制到editplus里面看
2013-10-24 10:55回复
才子城
才子城游客
#2
这真是不错的东西哦,值得研究,值得探讨,值得学习。谢谢分享!!!
2013-10-21 14:45回复
驴友之家
驴友之家游客
#1
很好,给力
2013-10-17 11:30回复