87,996
社区成员




<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>rrr</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<style type="text/css">
* {
margin: 0;
padding: 0
}
.herder_radius {
position: relative;
width: 100%;
background: #ccc;
}
.herder_text {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
}
.herder_name {
position: absolute;
width: 80px;
height: 80px;
border-radius: 50%;
left: 0;
top: 0;
right: 0;
margin: auto;
background: red;
text-align: center;
line-height: 80px;
font-weight: bold;
font-size: 50px;
-webkit-font-smoothing: antialiased;
font-family: '微软雅黑';
color: #fff;
white-space: nowrap;
overflow: hidden;
}
.content_box {
width: 100%;
background: #fff;
position: absolute;
top: 200px;
bottom: 0px;
left: 0;
overflow: hidden;
}
.herder_namefn {
text-align: center;
margin-top: 80px;
}
</style>
</head>
<body>
<div class="herder_radius" dataHeight="200">
<div class="herder_text">
<div class="herder_name">Re</div>
<div class="herder_namefn">测试程序</div>
</div>
</div>
<div class="content_box" id="wrapper">
<div>
<p>测</p>
<p>试</p>
<p>程</p>
<p>序</p>
<p>博</p>
<p>客</p>
<p>测</p>
<p>试</p>
<p>程</p>
<p>序</p>
<p>博</p>
<p>客</p>
<p>测</p>
<p>试</p>
<p>程</p>
<p>序</p>
<p>博</p>
<p>客</p>
<p>测</p>
<p>试</p>
<p>程</p>
<p>序</p>
<p>博</p>
<p>客</p>
<p>测</p>
<p>试</p>
<p>程</p>
<p>序</p>
<p>博</p>
<p>客</p>
<p>测</p>
<p>试</p>
<p>程</p>
<p>序</p>
<p>博</p>
<p>客</p>
<p>测</p>
<p>试</p>
<p>程</p>
<p>序</p>
<p>博</p>
<p>客</p>
</div>
</div>
<script src="http://sms.reyo.cn/include/aa/jquery.min.js"></script>
<script src="http://sms.reyo.cn/include/aa/iscroll-probe.js"></script>
<script>
(function ($) {
let herder_radiusH = $('.herder_radius').attr('dataHeight');
let herder_radiusT = $('.content_box').offset().top;
let windowH = $(window).height();
$('.herder_radius').height(herder_radiusH);
$('.content_box').height(windowH - herder_radiusH);
let herder_text = 0;
$(".herder_text>div").map(function () {
herder_text += parseInt($(this).height());
})
$('.herder_text').height(herder_text)
window.magnify = function (option) {
let myScroll = new IScroll('#wrapper', {
probeType: 3,
scrollbars: true,
interactiveScrollbars: true,
shrinkScrollbars: 'scale',
fadeScrollbars: true,
mouseWheel: true
});
myScroll.on('scroll', updatePosition);
myScroll.on('scrollEnd', updatePosition);
function updatePosition() {
let scrollH = this.y >> 0;
let radiuSscrollH = $('.herder_radius').height()
if (herder_text + scrollH > 0) {
let scale = scrollH / herder_radiusH + 1
$('.herder_text').css({
'transform': 'scale(' + scale + ')'
})
$('.herder_radius').css({
'height': Number(herder_radiusH) + scrollH,
})
$('.content_box').css({
'top': herder_radiusT + scrollH,
'height': windowH - herder_radiusH - scrollH
})
}
}
}
})(jQuery)
new magnify();
</script>
</body>
</html>
<script>
(function ($) {
/*let dataObj ={
herder_radiusH ,
herder_radiusT,
windowH,
herder_text
}*/
let dataObj = init();
$(window).resize(function(){
dataObj = init();
})
window.magnify = function (option) {
let myScroll = new IScroll('#wrapper', {
probeType: 3,
scrollbars: true,
interactiveScrollbars: true,
shrinkScrollbars: 'scale',
fadeScrollbars: true,
mouseWheel: true
});
myScroll.on('scroll', updatePosition);
myScroll.on('scrollEnd', updatePosition);
function updatePosition() {
let scrollH = this.y >> 0;
if (dataObj.herder_text + dataObj.scrollH > 0) {
let scale = scrollH / dataObj.herder_radiusH + 1
$('.herder_text').css({
'transform': 'scale(' + scale + ')'
})
$('.herder_radius').css({
'height': Number(dataObj.herder_radiusH) + scrollH,
})
$('.content_box').css({
'top': dataObj.herder_radiusT + scrollH,
'height': dataObj.windowH - dataObj.herder_radiusH - scrollH
})
}
}
}
})(jQuery)
new magnify();
function init(){
let herder_radiusH = $('.herder_radius').attr('dataHeight');
let herder_radiusT = $('.content_box').offset().top;
let windowH = $(window).height();
$('.herder_radius').height(herder_radiusH);
$('.content_box').height(windowH - herder_radiusH);
var herder_text = 0;
$(".herder_text>div").map(function () {
herder_text += parseInt($(this).height());
})
$('.herder_text').height(herder_text);
let dataObj ={
herder_radiusH: herder_radiusH,
herder_radiusT: herder_radiusT,
windowH: windowH,
herder_text: herder_text
}
return dataObj;
}
</script>
function updatePosition() {
/* 代码块 */
myScroll.refresh(); // 调用refresh方法
}