jQuery停止url在附加到函数的div中单击
我有一张这样的照片jQuery停止url在附加到函数的div中单击,jquery,html,show-hide,Jquery,Html,Show Hide,我有一张这样的照片 <div class="clickformore"> <h3>Business in<br>action</h3> <div class="foundoutmore"> <div class="uparrow"></div> <div class="underarrow"> <p>Develop critical and proble
<div class="clickformore">
<h3>Business in<br>action</h3>
<div class="foundoutmore">
<div class="uparrow"></div>
<div class="underarrow">
<p>Develop critical and problem solving skills faculties by investigating challenges faced by business leaders and to practice the skills to devise and implement practical solutions.<br><a href="http://www.ncl.ac.uk/postgraduate/modules/module/NBS8490/" target="_blank">http://www.ncl.ac.uk/postgraduate/modules/module/NBS8490/</a></p>
</div>
</div>
</div>
我试着瞄准css的链接,做一个z索引,希望它能在div隐藏之前首先被点击,但没有用,我试着想办法让显示div不再隐藏它,但我想不出这一点
在div隐藏之前,有没有办法让链接可以点击?使用这个bro
$(".foundoutmore").css("display","none");
$("h3").click(function(e){
e.preventDefault();
if($(this).next().css('display')=='none'){
$(this).next().css("display","inherit");
} else {
$(".foundoutmore").css("display","none");
}
});
使用这个兄弟
$(".foundoutmore").css("display","none");
$("h3").click(function(e){
e.preventDefault();
if($(this).next().css('display')=='none'){
$(this).next().css("display","inherit");
} else {
$(".foundoutmore").css("display","none");
}
});
到你的CSS,然后:
$(".clickformore").on('click', 'h3', function(e){
e.preventDefault();
var more = $(this).next('.foundoutmore');
more.toggle();
});
到你的CSS,然后:
$(".clickformore").on('click', 'h3', function(e){
e.preventDefault();
var more = $(this).next('.foundoutmore');
more.toggle();
});
我不完全确定原因,但这在我的代码中不起作用。我猜它一定与已经存在的代码冲突。无论如何谢谢你!我不完全清楚为什么,但这在我的代码中不起作用。我猜它一定与已经存在的代码冲突。无论如何谢谢你!这很有效,谢谢你。我添加了这一点,因为我有不止一个clickformore,我需要单击一个新的来隐藏其余的,而不是让它们打开<代码>$(“h3”)。单击(函数(e){e.preventDefault();如果($(this).next().css('display')='none'){$(.foundoutmore”).css(“display”,“none”);$(this.next().css(“display”,“inherit”);}否则{$(.foundoutmore”).css(“display”,“none”);})代码>(显然,我不知道这个网站上的样式设计是如何工作的,见图)这是有效的,谢谢。我添加了这一点,因为我有不止一个clickformore,我需要单击一个新的来隐藏其余的,而不是让它们打开<代码>$(“h3”)。单击(函数(e){e.preventDefault();如果($(this).next().css('display')='none'){$(.foundoutmore”).css(“display”,“none”);$(this.next().css(“display”,“inherit”);}否则{$(.foundoutmore”).css(“display”,“none”);})代码>(显然我不知道这个网站上的样式是如何工作的,见图)
$(".clickformore").on('click', 'h3', function(e){
e.preventDefault();
var more = $(this).next('.foundoutmore');
more.toggle();
});