markdown Venture - Sticky Mobile Header,顶部有公告栏

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Venture - Sticky Mobile Header,顶部有公告栏相关的知识,希望对你有一定的参考价值。

#What you want:

[![alt](https://screenshot.click/31-06-mt8o8-qnnh2.gif)](https://screenshot.click/31-06-mt8o8-qnnh2.gif)

#How to get it (SCSS / JS):

1. Add the following to the bottom of the theme.scss.liqiuid file:
```
@include media-query($small) {
  #shopify-section-header .site-header__upper {
    position: fixed;
    top: 42px;
    left: 0;
    display: block;
    z-index: 1000;
    background-color: $color-header;
  }
}
.notification--active {
  position: relative;
  display: inline-block;
}
@include media-query($small) { 
  .notification--active {
    position: fixed;
    top: 0;
  }
}
```

2. Add the following to the bottom of the theme.js file:
```
$(document).ready(function() {
  
  var notificationHeight = $('#NotificationPromoClose').outerHeight();
  var headerHeight = $('#shopify-section-header .site-header__upper').outerHeight();  	
  var mobileSize = 750;  
 
  // push header up if notification is closed
  $('#NotificationPromoClose').on('click',function(){
    $('#shopify-section-header .site-header__upper').css('top',0);
  });
  
  // check if notification bar is already closed on load of page
  if(notificationHeight == 0) {
    $('#shopify-section-header .site-header__upper').css('top',0);
  }  
  
  // push the slider down by the height of the header and promo bar on mobile
  $(window).resize(function() {
    if($(window).width() <= mobileSize){
      $('#MainContent').css('margin-top', headerHeight + notificationHeight);
    } else {
      $('#MainContent').css('margin-top', 60)
    }
  }).resize();
});
```

That is all! (ツ)

以上是关于markdown Venture - Sticky Mobile Header,顶部有公告栏的主要内容,如果未能解决你的问题,请参考以下文章

UVALive - 6275 Joint Venture (二分)

8VC Venture Cup 2016 - Elimination Round E. Simple Skewness(枚举+三分)

幕后的英雄--风险投资(venture capital)推荐阅读原书

The Hive, the venture fund and co-creation studio interview

Codeforces 8VC Venture Cup 2016 - Elimination Round F. Group Projects 差分DP*****

codeforces 8VC Venture Cup 2016 - Elimination Round C. Lieges of Legendre