Direct link to the content
I have a page http://bartle96.narod2.ru/demo.html there are 4 links开发者_JAVA百科 to the hidden content
Is it possible to make a direct link to the content such as "dolphin".
So that when you click on a link http://bartle96.narod2.ru/demo.html#delfin immediately opened a photo with a dolphin
Yes, you can define and open needed content on onload
event.
Check this post where you can find the same behaviour:
jQuery when pointed to a link should show a div that's hidden by default
You can get the hash value using window.location.hash
. Then set the pic you want based on the value.
window.onload = function() {
var pic = window.location.hash;
if ( pic === "#delfin" ) {
// Show picture of dolphin
}
}
精彩评论