gpt4 book ai didi

jquery - 如何使更改内容中的多个链接实例发挥作用?

转载 作者:行者123 更新时间:2023-12-01 04:11:22 25 4
gpt4 key购买 nike

我正在尝试制作某种内容幻灯片,但在使更改后的内容中的链接正常工作时遇到问题。第一个正确调用下一帧,但后续帧中的链接根本不起作用。到目前为止我的代码如下。非常感谢任何帮助。

<div class="overlaycontent">
Welcome, enjoy your stay!
<a class="mylink" data="demo" href="#">Get Started!</a>
</div>

<div id="helpDemo" style="display:none;"> This would be content 1 <a class="helplink" data="acts" href="#">Next</a> </div>
<div id="helpActs" style="display:none;"> This would be content 2 <a class="helplink" data="more" href="#">Next</a> </div>
<div id="helpMore" style="display:none;"> This would be content 3 </div>


$(".helplink").on("click",function(e){
if($(this).attr('data') == 'demo'){
$('.overlaycontent').html($('#helpDemo').html());
}
if($(this).attr('data') == 'acts'){
$('.overlaycontent').html($('#helpActs').html());
}
if($(this).attr('data') == 'more'){
$('.overlaycontent').html($('#helpMore').html());
}
});

最佳答案

改变

<a class="mylink" data="demo" href="#">Get Started!</a>

<a class="helplink" data="demo" href="#">Get Started!</a>

并且

$(".helplink").on("click",function(e){

$(".overlaycontent").on("click",".helplink",function(e){

Fiddle here.

关于jquery - 如何使更改内容中的多个链接实例发挥作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20000135/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com