国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jquery給圖片添加鼠標經過時的邊框效果

2019-11-20 21:43:26
字體:
來源:轉載
供稿:網友
一哥們兒要給圖片添加鼠標經過時的邊框效果,可惜出發點錯了,直接加在了IMG外的A標簽上致使 鼠標經過時圖片產生塌陷,實則應該將邊框控制直接加在IMG標簽上即可
錯誤代碼如下:注意紅色部分設置 (出發點就錯了)
復制代碼 代碼如下:

<html>
<head>
<script type="text/javascript" src="http://www.w3school.com.cn/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#box a").mouseover(function(){
$(this).css("border","1px solid red");
});
$("#box a").mouseout(function(){
$(this).css("border","none");
});
});
</script>
<style>
#box a{ display:block; z-index:1000; width:98px; height:98px;}
</style>
</head>
<body>
<div id="box" style="width:100px; height:100px;">
<a href="#"><img src="erwm.png" border="0" width="99" height="99"/></a>
<a href="#"><img src="erwm.png" border="0" width="99" height="99"/></a>
</div>
</body>
</html>

修改后的正確設計思路:紅色部分為調整后的設置
復制代碼 代碼如下:

<html>
<head>
<script type="text/javascript" src="http://www.w3school.com.cn/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#box img").mouseover(function(){
$(this).css("border","1px solid red");
});
$("#box img").mouseout(function(){
$(this).css("border","none");
});
});
</script>
<style>
#box a{ display:block; z-index:1000; width:98px; height:98px;}
</style>
</head>
<body>
<div id="box" style="width:100px; height:100px;">
<a href="#"><img src="erwm.png" border="0" width="99" height="99"/></a>
<a href="#"><img src="erwm.png" border="0" width="99" height="99"/></a>
</div>
</body>
</html>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 布拖县| 孝昌县| 海门市| 呼和浩特市| 平利县| 垦利县| 朔州市| 岳阳市| 三都| 准格尔旗| 姚安县| 乌恰县| 邓州市| 太谷县| 太保市| 彩票| 新平| 赤壁市| 成安县| 广平县| 礼泉县| 扶沟县| 赤峰市| 天峨县| 长兴县| 三都| 大城县| 略阳县| 霸州市| 慈溪市| 桐柏县| 建瓯市| 五家渠市| 兰溪市| 苏尼特右旗| 芜湖市| 西吉县| 寿宁县| 香格里拉县| 偃师市| 和田市|