H5页面实现原理分析分享

上海/产品设计师/9年前/898浏览
H5页面实现原理分析分享

大家一起试试吧

站酷网显示问题:<script>没有空格,黏贴好后记得删掉

<!doctype html>

<html>

<head>

<style>

html{overflow:hidden;}

body{ margin:0;}

.w img{width:100%;height:100%;}

</style>

<s cript src="js/jquery.js"> </s cript>

<meta charset="utf-8">

<title>H5页面实现原理分析</title>

</head>


<body>

<div class="w">

<div><img src="images/001.jpg"></div>

<div><img src="images/002.jpg"></div>

<div><img src="images/003.jpg"></div>

<div><img src="images/004.jpg"></div>

</div>

<s cript>

var wHeight=$(window).height();

$(".w div").height(wHeight);

var n=0;

$("body").click(function(){

if(n<$(".w div").length-1){

n=n+1;

}else{

$(".w").css({marginTop:0});

n=1;

}

$(".w").stop().animate({marginTop:-wHeight*n});

})

$(window).resize(function(){

wHeight=$(window).height();

$(".w div").height(wHelght);

$(".w").css({marginTop:-wHeight*n});

})

</s cript>

</body>

</html>


5
Report
|
5
Share
评论
in to comment
Add emoji
喜欢TA的作品吗?喜欢就快来夸夸TA吧!
Log in