js 實現(xiàn)圖片指向時變透明、JS控制圖片最大寬度
- 新建 JS.JS文檔,將以下代碼粘貼并保存。
 - 新建 index.html 文件,引用JS文檔如:<script type="text/javascript" src="http://www.contemporarypilgrim.com/js/common.js"></script>
 - 在引用圖片時使用如下代碼_信息來源 亳州網(wǎng)絡(luò)公司 易天科技
 - $(function () {
 - //案例變透明
 - $(".pro_img img,.pro_img2 img,.temp_img img").hover(function(){
 - $(this).fadeTo("fast",0.8)
 - },function(){
 - $(this).fadeTo("fast",1)
 - });
 - //end
 - //內(nèi)容圖片最大寬度
 - $(".productImg img").each( function() {
 - var maxwidth = 990;
 - if ($(this).width() > maxwidth) {
 - $(this).width(maxwidth);
 - }
 - });
 - //end
 - });
 - <div class="pro_img2">
 - <a href='此處填入鏈接地址' target='_blank'>
 - <img src='http://www.ywttx.com/uploads/image/20131011/20131011105344374437.jpg'>
 - </a>
 - </div>
 
JavaScript代碼
    XML/HTML代碼
    

