鼠標(biāo)放在最左邊的時(shí)候,e.pageX為什么是13?
? ? .left div,
? ? .right div {
? ? ? ? width: 300px;
? ? ? ? height: 80px;
? ? ? ? padding: 5px;
? ? ? ? margin: 5px;
? ? ? ? border: 1px solid #ccc;
? ? }
? ??
? ? .left div {
? ? ? ? background: #bbffaa;
? ? }
?
??<h4>測(cè)試二</h4>
? ? <div class="left">
? ? ? ? <div class="aaron1">
? ? ? ? ? ? <p>鼠標(biāo)在綠色區(qū)域移動(dòng)觸發(fā)mousemove</p>
? ? ? ? ? ? <p>移動(dòng)的X位置:</p>
? ? ? ? </div>
? ? </div>
? ? <script type="text/javascript">
? ? //綁定一個(gè)mousemove事件
? ? //觸發(fā)后修改內(nèi)容
? ? $(".aaron1").mousemove(function(e) {
? ? ? ? $(this).find('p:last').html('移動(dòng)的X位置:' + e.pageX)
? ? ? ? // e.pageX是鼠標(biāo)相對(duì)于文檔邊緣(文檔邊緣也就是document的邊緣)的X軸位置
? ? })
? ? </script>
2017-09-06
你把這段初始樣式指令放進(jìn)去,再將例子里
.left div,
.right div?
的css的padding margin 和border全部設(shè)置為0,那么e.pageX 初始值就為0
.left div,
? ? .right div {
? ? ? ? width: 300px;
? ? ? ? height: 80px;
? ? ? ? padding: 0px;
? ? ? ? margin: 0px;
? ? ? ? border: 0px solid #ccc;
? ? }
? ??
body{ margin: 0;padding: 0;font-family: "微軟雅黑";overflow: hidden;}
body,html{-webkit-text-size-adjust: none;width: 100%;height: 100%;}
*{text-decoration: none;list-style: none;}
img{border: 0px;}
ul,li,dl,dd,dt,p,ol,h1,h2,h3,h4,h5{font-size: 12px;font-weight: 100;padding: 0;margin: 0;}
.wrap{margin: 0 auto;}
.fl{float: left;}
.fr{float: right;}
.index{overflow: hidden;}
.clr{clear:both; height:0px; width:100%; font-size:1px; line-height:0px; visibility:hidden; overflow:hidden;}
.pointer{cursor:pointer;}
a,input,button{ outline:none; }
::-moz-focus-inner{border:0px;}
/*a:link {color:#0f0;text-decoration:none;}?
a:visited {color: #FFFF00; text-decoration:none;}?
a:hover {color: #00FF00; text-decoration:underline;}?
a:active {color: #0000FF; text-decoration:underline;}*/
a{color: #000;}
.wrapper{clear: both;width: 100%;}
word-break:break-all /*文字換行*/
/*white-space:nowrap 文字不換行*/
/*默認(rèn)滾動(dòng)條樣式修改ie9 google Firefox 等高版本瀏覽器有效*/
/*::selection {background: #D03333;color: white;text-shadow: none;}
::-webkit-scrollbar-track-piece{width:10px;background-color:#f2f2f2}
::-webkit-scrollbar{width:10px;height:6px}
::-webkit-scrollbar-thumb{height:50px;background-color:rgba(0,0,0,.3);}
::-webkit-scrollbar-thumb:hover{background:#cc0000}*/
/*漸變*/
/*background-image: -moz-linear-gradient(top, #8fa1ff, #3757fa);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #ff4f02), color-stop(1, #8f2c00)); Saf4+, Chrome?
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#c6ff00', endColorstr='#538300', GradientType='0'); IE*/
2017-03-20
不是起始值,是鼠標(biāo)在相對(duì)可視窗口當(dāng)前位置的值
2017-03-20
e.PageX是獲取當(dāng)前光標(biāo)的橫坐標(biāo)
最左邊是鼠標(biāo)在綠色區(qū)域移動(dòng)觸發(fā)mousemove的X軸的起始值,至于是怎么計(jì)算是我也不知道。
以上純屬個(gè)人理解
2017-03-17
e.pageY 、 e.pageX 是指鼠標(biāo)的XY(水平、垂直方向)位置值