码迷,mamicode.com
首页 > 其他好文 > 详细

图片选中出现边框效果

时间:2015-07-14 17:37:30      阅读:345      评论:0      收藏:0      [点我收藏+]

标签:

图片选中出现边框效果:

当点击选中图片时,图片能够出现红色的边框效果。

代码实例如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.51texiao.cn/" />
<title>蚂蚁部落</title>
<style type="text/css"> 
#mainboard img
{ 
  border:1px solid #cccccc; 
   width:88px; 
   height:31px; 
   cursor:pointer; 
} 
</style> 
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<script type="text/javascript"> 
$(function(){ 
   $("#mainboard img").bind("click",function(){ 
       $(this).css("border","1px solid red").siblings().css("border","1px solid #cccccc"); 
   }) 
}) 
</script> 
</head> 
<body> 
<div id="mainboard"> 
  <img src="1.gif" class="b" /> 
  <img src="2.gif" /> 
  <img src="3.gif" /> 
  <img src="4.gif" /> 
</div> 
</body> 
</html>

原文地址是:http://www.51texiao.cn/jqueryjiaocheng/2015/0504/687.html

最为原始地址是:http://www.softwhy.com/ 

图片选中出现边框效果

标签:

原文地址:http://www.cnblogs.com/come-on/p/4645628.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!