resetBounce( )

MUI HTML5

MUI

resetBounce( )

重置Webview窗口的回弹位置


void wobj.resetBounce();
						

说明:

开启窗口回弹效果后,当窗口中展现的内容滚动到头(顶部或底部)时,再拖拽时窗口整体内容将跟随移动,松开后自动回弹到停靠位置。 这时需要调用此方法来重置窗口的回弹位置,窗口将采用动画方式回弹到其初始显示的位置。

参数:

返回值:

void : 无

平台支持:

  • Android - 2.2+ (支持)
  • iOS - ALL (不支持)

示例:


<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
	<title>Webview Example</title>
	<script type="text/javascript">
var ws=null;
// H5 plus事件处理
function plusReady(){
	ws=plus.webview.currentWebview();
	ws.setBounce({position:{top:"100px"},changeoffset:{top:"44px"}});
}
if(window.plus){
	plusReady();
}else{
	document.addEventListener("plusready",plusReady,false);
}
// 重置窗口回弹位置
function resetBounce(){
	ws.resetBounce();
}
	</script>
	</head>
	<body style="text-align:center;">
		<br/><br/><br/>
		设置Webview窗口的回弹效果<br/>
		回弹后显示停靠到44px的位置<br/><br/>
		<button onclick="resetBounce()">重置回弹位置</button>
		<br/><br/><br/>
		*暂仅支持顶部的回弹效果*
	</body>
</html>