本文实例讲述了JS实现网页游戏中滑块响应鼠标点击移动效果。分享给大家供大家参考,具体如下:
这是网页游戏中的一个有趣效果,可以完成以下几个动作:滚动、scroll 8个方向、鼠标坐标获娶对象上下左右位置获取,大家可以自己添加、MoveReady和ScrollReady两个注释掉了 取消注释后防止鼠标连续点击效果叠加。
在线演示地址如下:
http://demo.jb51.net/js/2015/js-web-game-click-move-demo/
具体代码如下:
网页游戏中的一个有趣效果 html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,address,big,cite,del,em,img,ins,small,strong,sub,sup,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,tbody,tfoot,tr,th,td{margin: 0;padding: 0;border: 0;outline: 0;font-size: 100%;vertical-align: baseline;background: transparent;} body{font:12px/24px "宋体";background:#fff;color:#333;} ol, ul{list-style:none;} blockquote, q {quotes:none;} blockquote:before, blockquote:after, q:before, q:after {content: '';content:none;} :focus {outline:0;} ins {text-decoration:none;} del {text-decoration:line-through;} table {border-collapse:collapse;border-spacing:0;} label{cursor:pointer} input[type="button"]{cursor:pointer} button{cursor:pointer} strong{font-weight:normal;} em{font-style:normal} a{text-decoration:none;color:#f60} a:hover{text-decoration:underline;} .block{width:200px;height:200px;background:#e63;position:absolute;left:50%;top:50%;border:3px solid #fdd;overflow:hidden;} .moveBlock{width:1900px;height:2728px;background:url("//img.jbzj.com/file_images/article/201510/2015101993654799.jpg") left top;}
希望本文所述对大家Javascript程序设计有所帮助。



