滚动页面的实现头部缩放-并使用过度看着不那么生硬

JS脚本

//头部特效脚本开始===================================================
$(window).scroll(function (){
    headerInit();
});

function headerInit (){
    if($(this).scrollTop()>0){
        $("body").addClass("fiexed-header-on");                  //在body上添加一个样式“fiexed-header-on”就相当于body了  
}else{ $("body").removeClass("fiexed-header-on"); } } 
headerInit(); //头部特效脚本结束====================================================

CSS样式

/*特效开始******************************************/
.fiexed-header-on header{                                        //头部中的header元素
    height: 70px;
    background-color: rgba(0,0,0,0.95);
}
.fiexed-header-on .bigContain{
    font-size:24px;

    transition: all 0.3s ease-in-out;
}
.fiexed-header-on .log{
    transform: scale(0.8);
}
.fiexed-header-on .bigContain.smallContain{
    margin-left:5px;
}
.fiexed-header-on .col-md-8{
    margin-top:5px;
}
/*头部样式==结束========================================================================================*/

 

这样滚动的话太生硬,需要设置下过度

.bigContain{
    font-size:36px;
    transition: all 0.3s ease-in-out;  
}

transition:所有属性 0.3秒  浅进浅出;

  

 

转载于:https://www.cnblogs.com/xiaowie/p/9854787.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值