Commit 343abf52 by 胡悦

init

0 parents
body, p {
margin: 0;
}
.wrapper-header {
display: flex;
align-items: center;
position: fixed;
width: 100%;
height: 46px;
top: 0;
padding-left: 10px;
background-color: #ffffff;
z-index: 1;
}
.wrapper-header p {
flex: 1;
text-align: center;
}
.wrapper-back {
position: relative;
}
.wrapper-back:before {
content: " ";
width: 12px;
height: 24px;
-webkit-mask-position: 0 0;
mask-position: 0 0;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-size: 100%;
mask-size: 100%;
background-color: rgba(0, 0, 0, 0.3);
color: rgba(0, 0, 0, 0.3);
color: var(--weui-FG-2);
-webkit-mask-image: url(data:image/svg+xml,%3Csvg%20width%3D%2212%22%20height%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.454%206.58l1.06-1.06%205.78%205.779a.996.996%200%20010%201.413l-5.78%205.779-1.06-1.061%205.425-5.425-5.425-5.424z%22%20fill%3D%22%23B2B2B2%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E);
mask-image: url(data:image/svg+xml,%3Csvg%20width%3D%2212%22%20height%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.454%206.58l1.06-1.06%205.78%205.779a.996.996%200%20010%201.413l-5.78%205.779-1.06-1.061%205.425-5.425-5.425-5.424z%22%20fill%3D%22%23B2B2B2%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E);
position: absolute;
top: 50%;
left: 0;
margin-top: -12px;
transform: rotate(180deg);
}
.wrapper-content {
margin-top: 46px;
}
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<script src="js/rem.js" type="text/javascript" charset="utf-8"></script>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<link href="css/mui.min.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="css/navigation.css">
<title>小精灵说明书</title>
</head>
<body>
<div class="wrapper-header">
<div class="wrapper-back" onclick="back()"></div>
<p>使用说明书</p>
</div>
<div class="wrapper-content">
<div class="layout">
<div class="mui-slider">
<div class="mui-slider-group">
</div>
</div>
</div>
</div>
</body>
</html>
<script src="js/mui.min.js"></script>
<script type="text/javascript">
rem(window, {
designWidth: 750,
designHeight: 667,
designFontSize: 200
})
let pageNum = 0
const gallery = mui('.mui-slider')
function getBanner(count = 0, size = 2){
pageNum = count
for(count; count < size; count++) {
if(count< 22) {
$('.mui-slider-group').append(`<div class="mui-slider-item"><img src='img/img${count}.jpg' style="height:${$(window).height()}px" /></div>`)
gallery.slider({
interval: 0
})
}
}
}
getBanner()
document.querySelector('.mui-slider').addEventListener('slide', function(event) {
if(event.detail.slideNumber + 1 <= pageNum) return
getBanner(event.detail.slideNumber + 1, event.detail.slideNumber + 2)
})
function back() {
window.history.go(-1)
}
</script>
<style type="text/css">.layout {
position: fixed;
width: 100vw;
height: 100vh;
top: 0;
left: 0;
}</style>
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
function rem(win, option) {
var count = 0,
designWidth = option.designWidth,
designHeight = option.designHeight || 0,
designFontSize = option.designFontSize || 20,
callback = option.callback || null,
root = document.documentElement,
body = document.body,
rootWidth, newSize, t, self
//返回root元素字体计算结果
function _getNewFontSize() {
var scale = designHeight !== 0 ? Math.min(win.innerWidth / designWidth, win.innerHeight / designHeight) : win.innerWidth / designWidth
return parseInt(scale * 10000 * designFontSize) / 10000
}
!function () {
rootWidth = root.getBoundingClientRect().width
self = self ? self : arguments.callee
//如果此时屏幕宽度不准确,就尝试再次获取分辨率,只尝试20次,否则使用win.innerWidth计算
if (rootWidth !== win.innerWidth && count < 20) {
win.setTimeout(function () {
count++
self()
}, 0)
} else {
newSize = _getNewFontSize()
//如果css已经兼容当前分辨率就不管了
if (newSize + 'px' !== getComputedStyle(root)['font-size']) {
root.style.fontSize = newSize + "px"
return callback && callback(newSize)
}
}
}()
//横竖屏切换的时候改变fontSize,根据需要选择使用
win.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function () {
clearTimeout(t)
t = setTimeout(function () {
self()
}, 200)
}, false)
} (window, {
designWidth: 750,
designHeight: 667,
designFontSize: 200,
callback: function (argument) {
//console.log(argument)
}
})
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!