jquery图片点击自动翻页实现

采用JQuey要实现图片点击自动向上,向下翻页! 代码:

 

 

$(document).ready(function() {
	$("img").mousemove(function(e){  
		var positionX=e.originalEvent.layerX||e.originalEvent.x||0;
		if(positionX<=$(this).width()/2){           
			 this.style.cursor='url("/image/single/pre.cur"),auto';
			 $(this).attr('title','点击查看上一张');
			 $(this).parent().attr('href','$url&goto=up'); 
		}else{  
			 this.style.cursor='url("/image/single/next.cur"),auto';
			 $(this).attr('title','点击查看下一张');
			 $(this).parent().attr('href','$url&goto=down');
		} 
	});
});
 

 

以上基本实现功能啦!!!

 

付:

 

关于chrome下:

 

 

event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.
 

详细可以访问http://stackoverflow.com/questions/7825448/webkit-issues-with-event-layerx-and-event-layery

 

 

 

 

你可能感兴趣的:(jquery)