【鼠标事件】
位于图片左侧还是右侧
<!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <style> .arrow-right { cursor: help; } .arrow-left { cursor: crosshair; } </style> </head> <body> <img src="http://pic002.cnblogs.com/images/2012/382256/2012080118323766.gif" width="300" height="225"> <script src="http://upcdn.b0.upaiyun.com/libs/jquery/jquery-2.0.3.min.js"></script> <script> var $img = $('img') var position = $img.offset().left + $img.width() / 2 $img.bind('mousemove', function(e) { e || (e = window.event) if (e.pageX < position) { $img[0].className = 'arrow-left' } else { $img[0].className = 'arrow-right' } }) </script> </body> </html>