我正在使用这个模板agency ,它是用 bootstrap v.3 构建的。在作品集中,当您单击其中一个项目时,会显示一个包含更多信息的页面。如何设置链接格式,以便直接导航到该页面? 我在网址末尾添加了#portfolioModal1,但它不起作用..
最佳答案
您必须为此使用脚本,例如 link
使用这个:
<script>
if(window.location.hash) {
var hash = window.location.hash;
$(hash).modal('toggle');
}
$('.portfolio-link').click(function(){
window.location.hash = $(this).attr('href');
});
</script>
这样调用它:
http://ironsummitmedia.github.io/startbootstrap-agency/#portfolioModal1
关于javascript - 如何格式化 url 以便直接导航到网站中的特定位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32724699/