母親節最火的兩件事
1.NBA 杜蘭特在獲MVP催淚致辭獻給母親:她才是真的MVP。
2.QQ空間長圖
--------------------------------------------------------------------------------------------
今天的demo就是模擬 QQ空間這個效果
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title> qq長圖 </title> <script> var iSpeed=5; var timer=null; window.onload=function () { var oParent=document.getElementById('divParent'); var oChild=document.getElementById('divChild'); var oImg=document.getElementById('img1'); var imgHeight=oImg.offsetHeight;//圖片的總高度 var parentZone=oParent.offsetHeight; var halfPos=parseInt(parentZone/2,10); oParent.onmousemove=function(ev){ var oEvent=ev||event; var disY=oEvent.clientY - oParent.offsetTop;;//鼠標的有效位置 clearInterval(timer); timer=setInterval(function(){ if(disY<halfPos){ //向上移動 if(oChild.offsetTop<0){ //如果圖片移動到頂部 就繼續運動 oChild.style.marginTop=oChild.offsetTop+iSpeed+'px'; } else{ clearInterval(timer); oChild.style.marginTop=0; //如果到了頂部 } } else{ //向下移動 if(Math.abs(oChild.offsetTop)<imgHeight-oParent.offsetHeight){ oChild.style.marginTop=oChild.offsetTop-iSpeed+'px'; } else{ clearInterval(timer); oChild.style.marginTop=-imgHeight+oParent.offsetHeight+'px'; } } },35); } oParent.onmouseout=function(){ clearInterval(timer); } } </script > </head> <body> <div id="divParent" style="position:absolute;width:462px;border:1px solid #abcdef;height:500px;overflow:hidden;cursor:pointer;"> <div id="divChild" style="position:relative;margin-top:0;"> <img src="mmhappy.jpg" border="0" id="img1"/ > </div> </div> </body> </html>
2個小時后 雷霆vs快船 第四場 cctv5
最后祝天下母親身體健康,萬事如意