Short (72 chars or less) summary
More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).
Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getElementIndex($list, $target) { | |
const nodes = Array.prototype.slice.call($list); | |
const elementIndex = nodes.indexOf( $target ); | |
return elementIndex; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.no-scroll { | |
position: fixed; | |
top: 0; | |
left: 0; | |
width: 100%; | |
-webkit-overflow-scrolling: touch; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener('pageshow', (event) => { | |
// detect Backward/Forward Cache alias BF cache | |
// if render from cache then reload page | |
if (event.persisted || window.performance && | |
window.performance.navigation.type === 2) { | |
window.location.reload(); | |
} | |
}; | |
//jquery 中没有这个对象,需要用原生事件对象 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*horizontally center*/ | |
.flex-horizonal-center { | |
display: -webkit-box; | |
display: -webkit-flex; | |
display: -moz-box; | |
display: -moz-flex; | |
display: -ms-flexbox; | |
display: flex; | |
/* 水平居中*/ | |
-webkit-box-align: center; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*vertical center*/ | |
.flex-vertical-center { | |
display: -webkit-box; | |
display: -webkit-flex; | |
display: -moz-box; | |
display: -moz-flex; | |
display: -ms-flexbox; | |
display: flex; | |
flex-direction: column; | |
/* 垂直居中 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Flexbox Mixins | |
// http://philipwalton.github.io/solved-by-flexbox/ | |
// https://github.com/philipwalton/solved-by-flexbox | |
// | |
// Copyright (c) 2013 Brian Franco | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a | |
// copy of this software and associated documentation files (the | |
// "Software"), to deal in the Software without restriction, including | |
// without limitation the rights to use, copy, modify, merge, publish, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// REM 适配 <html> | |
// 750px (iPhone 6) | |
// 此为基准值, 与视觉设计稿 `宽度/2` 保持一致 | |
html[data-rem="375"] { | |
font-size: 20PX; | |
} | |
// 17.06 = 320*20/375 (iPhone 5) | |
@media only screen and (min-width: 640px) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.flex-vertical-direction { | |
display: -webkit-box; | |
display: -webkit-flex; | |
display: -moz-box; | |
display: -moz-flex; | |
display: -ms-flexbox; | |
display: flex; | |
flex-direction: column; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.flex-horizonal-direction { | |
display: -webkit-box; | |
display: -webkit-flex; | |
display: -moz-box; | |
display: -moz-flex; | |
display: -ms-flexbox; | |
display: flex; | |
flex-direction: row; | |
} |