`
xhuang
  • 浏览: 30006 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

jquery图片点击自动翻页实现

    博客分类:
  • JQ
阅读更多

采用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

 

 

 

 

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics