For example, there are several links to other external pages:
a b c d e
Then in the jump details page after clicking, the five abcde modules are all in this page. The first a is displayed by default, and the others are is display:none;
Is it possible to jump to the details page when clicking the b link on the external page and directly display the b content. Except for the b content, other contents are display: none.
When clicking the c link on the external page, Jump to the details page and display c content directly. Except for c content, other contents are display:none,
External page:
<a href="1.html">a</a>
<a href="1.html">b</a>
<a href="1.html">c</a>
<a href="1.html">d</a>
<a href="1.html">e</a>
The page of 1.html after the jump:
<ul class="uls">
<li class="uls_li_checked">a</li>
<li>b</li>
<li>c</li>
<li>d</li>
<li>e</li>
</ul>
<p class="con">
<p>a的内容</p>
<p style="display:none;">b的内容</p>
<p style="display:none;">c的内容</p>
<p style="display:none;">d的内容</p>
<p style="display:none;">e的内容</p>
</p>
<script>
$('.uls li').on('click',function(){
var aIndex = $(this).index();
$('.con p').css({'display':'none'});
$('.con').eq(aIndex).css({'display':'block'});
})
</script>
Add a parameter to each of the five links, for example
Then judge the parameters behind the url in the js of this page to decide which one to display and which one to hide.
window.location.hash can get the parameters of the url.
Just use the above method to determine which link you came from, and the corresponding block will be displayed.
Just use anchor points to achieve it
I think you should have a brief understanding of HTML, and then start learning the more popular front-end development, such as: (Vue.js)[https://cn.vuejs.org/], (React.js)[http:/ /react-china.org/], (AngularJS)[https://angularjs.org/], etc. Because of the kind of interaction you mentioned, in addition to using conventional dynamic programming languages (such as PHP, Java, etc.), the front-end implementation is still relatively troublesome.
I won’t go into details here. You can refer to a question I answered before: /q/10…. His needs are very similar to what you said, just one pass
username
, one passindex
;The approximate code is as follows:
Here is the anchor point passed as a parameter:
1.html Get the incoming anchor information