最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

JS實(shí)現(xiàn)的鼠標(biāo)跟隨代碼(卡通手型點(diǎn)擊效果)

 更新時(shí)間:2015年10月26日 11:10:09   作者:企鵝  
這篇文章主要介紹了JS實(shí)現(xiàn)的鼠標(biāo)跟隨代碼,帶有卡通手型點(diǎn)擊效果.涉及JavaScript鼠標(biāo)事件的響應(yīng)與頁(yè)面元素的動(dòng)態(tài)調(diào)用技巧,需要的朋友可以參考下

本文實(shí)例講述了JS實(shí)現(xiàn)帶有小手點(diǎn)擊效果的鼠標(biāo)跟隨代碼。分享給大家供大家參考,具體如下:

一個(gè)跟隨鼠標(biāo)的小手效果,鼠標(biāo)移在哪里,小手就跟著移向哪里,會(huì)出現(xiàn)手的效果,放在鏈接上的時(shí)候,手會(huì)變化,兩只手很可愛哦,JS鼠標(biāo)跟隨代碼分享與大家。

運(yùn)行效果截圖如下:

在線演示地址如下:

http://demo.jb51.net/js/2015/js-handle-style-focus-codes/

具體代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>可愛的鼠標(biāo)跟隨</title>
<style>
html{ background:#000;}
body,html,input{ cursor:none;}
body,html{ height:100%;}
#cursor{ position:absolute; left:100px; top:100px; display:block;}
</style>
<script>
 window.onload = function(){
  var oCursor = document.getElementById("cursor");
  document.onmousemove=function (ev){
   var oEvent=ev||event,
    oWidth = document.documentElement.clientWidth,
    oHeight = document.documentElement.clientHeight,
    scrollTop=document.documentElement.scrollTop + oEvent.clientY,
    scrollLeft=document.documentElement.scrollLeft + oEvent.clientX;
   if(scrollTop > oHeight-oCursor.offsetHeight){
    oCursor.style.top = oHeight-oCursor.offsetHeight+'px';
   }else if(scrollTop < 0){
    oCursor.style.top = 0;
   }else{
    oCursor.style.top = scrollTop+'px';
   }
   if(scrollLeft > oWidth-oCursor.offsetWidth){
    oCursor.style.left = oWidth-oCursor.offsetWidth+'px';
   }else{
    oCursor.style.left = scrollLeft+'px';
   }
   document.onmousedown = function(){
    oCursor.innerHTML = "<img src='images/cursor_hover.png' />"; 
    return false;
   }
   document.onmouseup = function(){
    oCursor.innerHTML = "<img src='images/cursor.png' />"; 
   }
  };
 }
</script>
</head>
<body>
<div id="cursor"><img src="images/cursor.png" /></div>
<input type="button" style="font-size:36px; margin:100px;" value="點(diǎn)擊" onclick="window.open('http://www.baidu.com')" />
</body>
</html>

希望本文所述對(duì)大家JavaScript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論

苍溪县| 武隆县| 巴彦淖尔市| 六安市| 金寨县| 保亭| 乐业县| 承德市| 株洲市| 基隆市| 五华县| 依安县| 南汇区| 东至县| 彭泽县| 鹤山市| 云浮市| 英吉沙县| 松江区| 东阿县| 蓝山县| 松潘县| 阳朔县| 巫溪县| 田阳县| 大余县| 辽中县| 杂多县| 博湖县| 徐闻县| 临沧市| 沅江市| 奉化市| 格尔木市| 宿迁市| 阜阳市| 五原县| 南开区| 靖西县| 伊金霍洛旗| 吉林市|