简体   繁体   English

Removeclass不适用于图像

[英]Removeclass doesn't work for image

I'd like your help please on this please. 我想请你帮忙。

I am not able to remove the active link from unselected image. 我无法从未选中的图像中删除活动链接。

Here is the code: 这是代码:

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

Html 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 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;}

maybe like somethig like this demo 也许就像这个演示一样

$(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