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

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

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

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

一個跟隨鼠標(biāo)的小手效果,鼠標(biāo)移在哪里,小手就跟著移向哪里,會出現(xiàn)手的效果,放在鏈接上的時候,手會變化,兩只手很可愛哦,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>

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

相關(guān)文章

最新評論

会昌县| 巴楚县| 台湾省| 纳雍县| 龙岩市| 云梦县| 玛曲县| 兴宁市| 南木林县| 屏山县| 个旧市| 左权县| 伊金霍洛旗| 红河县| 赣州市| 龙陵县| 大埔县| 山西省| 广宁县| 轮台县| 吉水县| 贡觉县| 大余县| 高雄市| 济南市| 普定县| 湖口县| 密山市| 建湖县| 资中县| 洛隆县| 泾阳县| 渭源县| 敦化市| 夏邑县| 志丹县| 塔城市| 军事| 香河县| 道孚县| 青河县|