Javascript 将用户重定向到同一页面,但重定向到特定选项卡
我想将用户重定向到同一页面,但当用户单击“#myRegistrationsClean”时,会将选项卡“#myRegistrations”显示为活动状态 但是,使用下面的代码,用户将被重定向到同一页面,但#myRegistrations选项卡不会保持活动状态。这是因为下面的代码只是像“window.location.reload();”一样刷新页面 您知道如何在“#myRegistrations”处于活动状态时重定向到同一页面吗?将“myRegistrations”选项卡变为活动的url为“”Javascript 将用户重定向到同一页面,但重定向到特定选项卡,javascript,jquery,laravel,Javascript,Jquery,Laravel,我想将用户重定向到同一页面,但当用户单击“#myRegistrationsClean”时,会将选项卡“#myRegistrations”显示为活动状态 但是,使用下面的代码,用户将被重定向到同一页面,但#myRegistrations选项卡不会保持活动状态。这是因为下面的代码只是像“window.location.reload();”一样刷新页面 您知道如何在“#myRegistrations”处于活动状态时重定向到同一页面吗?将“myRegistrations”选项卡变为活动的url为“” 试
试着这样做:
。模式覆盖:目标{
能见度:可见;
不透明度:1;
}
.模态叠加{
位置:绝对位置;
顶部:50px;
底部:0;
左:0;
右:0;
背景:rgba(0,0,0,0.15);
过渡:不透明度200ms;
可见性:隐藏;
溢出:隐藏;
不透明度:0;
z指数:10;
}
模态内容
以下代码将根据您的需要使用。“scrollTop”功能用于在窗口中滚动。确保您正在使用jQuery库,因为动画功能依赖于它
jQuery('body,html').animate({scrollTop:jQuery(#myRegistrations”).offset().top})
您可以使用window.location.hash
$('#myRegistrationsClean')。单击(函数(){
警报(“测试”);
if(会话('searchedConferences')){
//$('#cleanSearch')。单击();不起作用
window.location.hash=“myRegistrationsClean”;
window.location.reload();
}
});代码>
$('#myRegistrationsClean').click(function() {
alert("test");
@if(session('searchedConferences'))
// $('#cleanSearch').click(); dont works
window.location.reload();
@endif
});