css 使用CSS动画修复缩小标题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 使用CSS动画修复缩小标题相关的知识,希望对你有一定的参考价值。

jQuery(function( $ ){
 
	$(".site-header").after('<div class="bumper"></div>');
 
	$(window).scroll(function () {
		if ($(document).scrollTop() > 50 ) {
			$('.site-header').addClass('shrink');
		} else {
			$('.site-header').removeClass('shrink');
		}
	});
 
});
/* Shrinking fixed header, only for larger screens */
@media only screen and (min-width: 840px) {
  .site-header {
    position: fixed;
    width: 100%;
    z-index: 999;
  }
  .title-area {
    padding-top: 16px;
    padding-bottom: 0;
  }
  .site-header .wrap, .bumper {
    min-height: 100px;
  }
  .site-header, .site-header .wrap, .site-description, .site-header .wrap .title-area, .header-image .site-title, .header-image .site-title a .widget-area.header-widget-area {
    -webkit-transition: all 0.5s ease-in-out;
    -moz-transition: all 0.5s ease-in-out;
    transition: all 0.5s ease-in-out;
  }
  .site-header.shrink {
    border-bottom: 1px solid #E8DEDA;
    min-height: 50px;
  }
  .shrink .wrap {
    background-color: rgba(255, 255, 255, 0.1);
    min-height: 60px;
    padding: 0;
  }
  .shrink .site-title {
    font-size: 20px;
    padding-top: 3px;
  }
  .header-image .shrink .site-title {
    padding: 0;
  }
  .header-image .shrink .site-title &gt;a {
    min-height: 50px;
  }
  /* Use a smaller logo in the header after shrinking */
  .site-header.shrink .wrap .title-area {
    background: url("images/logo-mini2.png") no-repeat scroll left top rgba(0, 0, 0, 0);
    height: 50px;
    margin: 8px 0 0;
    -webkit-transition: all 0.5s ease-in-out;
    -moz-transition: all 0.5s ease-in-out;
    transition: all 0.5s ease-in-out;
  }
  .site-header.shrink .widget-area {
    padding-top: 5px;
    -webkit-transition: all 0.5s ease-in-out;
    -moz-transition: all 0.5s ease-in-out;
    transition: all 0.5s ease-in-out;
  }
}

以上是关于css 使用CSS动画修复缩小标题的主要内容,如果未能解决你的问题,请参考以下文章

如何修复 CSS 下拉列表动画?

滑块的 CSS SVG 动画

CSS动画:悬停和悬停

text 修复滚动水平css动画

css 修复动画故障

CSS动画方向问题