簡體   English   中英

Removeclass不適用於圖像

[英]Removeclass doesn't work for image

我想請你幫忙。

我無法從未選中的圖像中刪除活動鏈接。

這是代碼:

$(function(){
    $(document).ready(function() {
        $(".Nav_thumb a").click(function() {
            $(this).removeClass("active");
            $(this).addClass('active');     
        });
    });
});

HTML

<div id="pageNav_thumb">
    <div class="Nav_thumb">  
        <a id="img1" href="javascript:();" onClick="ShowVideo(1); return false;"> 
            <img src="img/Press2.jpg" height="79" width="140" />
        </a>
    </div>
    <div class="Nav_thumb">   
        <a id="img2" href="javascript:();" onClick="ShowVideo(2); return false;">
            <img src="img/Working2g.jpg" height="79" width="140" />
        </a>
    </div> 
    <div class="Nav_thumb">   
        <a id="img3" href="javascript:();" onClick="ShowVideo(3); return false;"> 
            <img src="img/Press2.jpg" height="79" width="140" />
        </a>
    </div> 
</div>

CSS

#pageNav_thumb {
    width: 850px;
    max-width: 100%;
    background:url(../img/foot_04.jpg) no-repeat;
    min-width:850px;
    height:210px;
}
.Nav_thumb {margin:30px 0 0 10px; float:left;}
.Nav_thumb  A { display:inline-block; border: 2px solid rgb(51,51,51);}
.Nav_thumb  A:hover { border: 2px solid red; }
.Nav_thumb A:active  { border: 2px solid red;}
.Nav_thumb A:focus {outline:0;}

也許就像這個演示一樣

$(document).ready(function() {
    $(".Nav_thumb a").click(function() {
        $('.Nav_thumb a').removeClass("active");
        $(this).addClass('active');
    }); 
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM