[英]How do I add contact.handlebars as a link to my index.html instead of contact.html?
[英]How do I link back to a tab on my index.html?
我在https://gallant-euclid-b426b2.netlify.com上的項目有三個標簽
當您單擊一個項目時,您將被定向到一個新頁面。 我希望這些標簽可以在該新頁面上使用。 我如何做到這一點? 因此,“學校”標簽將鏈接回index.html上的“學校”標簽,並將“項目”標簽鏈接到“項目”標簽。
(返回學校標簽實際上已經可以使用,因為這是默認標簽)
我不想使用history.back()
因為某人可能將項目鏈接發送給某人,然后可能沒有上一頁等。
<div class="bar">
<div class="tab">
<button class="tablinks" id="defaultopenTab" onclick="openTab(event, 'school')">school</button>
<button class="tablinks" onclick="openTab(event, 'projects')">projects</button>
<button class="tablinks" onclick="openTab(event, 'about')">about</button>
</div>
</div>
我希望有一個解決方案,在這里我可以簡單地說:
onclick="location.href='index.html'; openTab(event, projects)"
office.html頁上的標簽代碼必須與index.html中的標簽代碼相同
<div id="school" class="tabcontent">
<h1>industrial design</h1>
<div class="project" onclick="location.href='office.html';">
<div class="img" id="some"></div>
<div class="name">Project 1</div>
<div class="label">Industrial Design</div>
</div>
<div class="project" onclick="location.href='office.html';">
<div class="img" id="some"></div>
<div class="name">Project 2</div>
<div class="label">Industrial Design</div>
</div>
<div class="project_long" onclick="location.href='office.html';">
<div class="img_long" id="stage"></div>
<div class="name">Stage</div>
<div class="label">Industrial Design</div>
</div>
<div class="project" onclick="location.href='office.html';">
<div class="img" id="office"></div>
<div class="name">Office Rating System</div>
<div class="label">Industrial Design</div>
</div>
</div>
您可以通過復制和粘貼或通過腳本來靜態地執行此操作。 例如,您可以將每個選項卡綁定到共享的javascript文件。
更改
<div class="project" onclick="location.href='office.html';">
至
<div class="project" id="office">
然后在腳本中
$(document).on("click","#office",function(){
windows.open("office.html","_self");
});
對每個選項卡執行此操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.