English 中文(简体)
Jquery 带有数字- 帮助的幻灯片显示, 数字链接会保持颜色, 直到选中其它链接?
原标题:Jquery Slideshow with numbers--help have number links stay color until another is selected?

我对此进行了无休止的研究,并尝试了类似问题的其他答案,但却没有运气。 我希望数字(即链接)在被选中时会变成一种颜色, 并保持这个颜色, UNTIL会选择另一个数字/链接, 并恢复到原来的颜色 。

我拿到了脚本可以工作, 以便它选择时改变颜色... 但是当选择下一个链接时它不会改变。 下面是我的代码( 如果它没有正确显示, 请道歉 ) 。 如果您需要看到更多信息, 请告诉我! 这是连接现场测试页面的链接 : < a href=" http://bmwww.com/ clients/index3/ casestudies/ cabrini_ casesty3. html" rel=“ nofol” >http:// bmww.com/clients/index3/ casestudicides/ cabrini_casestudy3. html

脚本 :

        <script type="text/javascript">
        $(window).load(function () {
$( .slideshow ).blinds();

})
$(document).ready(function(){
$( a ).click(function(){
    $(this).toggleClass( clicked );
    });
});
    </script>

这是我的CS:

<style>

a{
color: #666335;
}

a.clicked{
color: #D85D27;
}

这是我的 html :

<a href="#" class="change_link" onclick="$( .slideshow ).blinds_change(1); return     false">1</a>
<a href="#" class="change_link" onclick="$( .slideshow ).blinds_change(2); return false">2</a>
<a href="#" class="change_link"  onclick="$( .slideshow ).blinds_change(3); return false">3</a>
<a href="#" class="change_link"  onclick="$( .slideshow ).blinds_change(4); return false">4</a>
<a href="#" class="change_link" onclick="$( .slideshow ).blinds_change(5); return false">5</a>
<a href="#" class="change_link" onclick="$( .slideshow ).blinds_change(6); return false">6</a>
<a href="cabrini_casestudy2.html" class="ex1" >     >> </a>
问题回答

如果您再次点击同一链接, 您的代码将会有效 。

尝试一下这个 :

$(document).ready(function(){
$( a.change_link ).click(function(){
    $( .clicked ).removeClass( clicked );
    $(this).addClass( clicked );
    });

});




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签