JQ-动画合集(ing...)

一:给向上按钮加动画,让页面卷回上面而不是生硬跳转.js

$('#topBtn').click(function(){
            $('html,body').animate({scrollTop: '0px'}, 1000);
        return false;
        });
//给向上按钮加一个animate的动画,控制scrolltop属性变为零,在1秒内,

(可以加一个$()包起来,当其所在的js页面中有这个设置后,直接copy进去就ok了)

——————————————————————————————————

2017-04-17  17:16:57

二:tab选项卡,用jq实现

$('菜单标签名').click(function(){
    $(this).addClass('hover时的样式名字').siblings().removeClass('hover时的样式名字');
    var index=$(this).index();
    $('对应标签出现的内容区域').eq(index).show().siblings().hide();
});

例子:

1 $('.title li').click(function(){
2     $(this).addClass('on').siblings().removeClass('on');
3     var index=$(this).index();
4     $('.div_tab > div').eq(index).show().siblings().hide();
5 });

有空再继续填补,有点高中一点一点补笔记本的感觉,每天学到的补一点,到了高考,我的笔记本是最烂的。额。。。。

原文地址:https://www.cnblogs.com/padding1015/p/6254062.html