开发者

Dynamic generated HTML deep linking

开发者 https://www.devze.com 2023-03-11 23:43 出处:网络
I have a problem with deep linking. I have a single page site, in which I have many small boxes and a single big boxes, that is the \'active\' content. Clicking on a small box, I clear the innerHTML.

I have a problem with deep linking. I have a single page site, in which I have many small boxes and a single big boxes, that is the 'active' content. Clicking on a small box, I clear the innerHTML. Wtart an animation, the clicked become the active content, then I replace the innerHTML($('element').html('new content')) with the new content.

My question is: there is a way to deep开发者_Python百科 link this process, to have:

mysite.com/firstcontent (or something similar) and have the right content active, without have to write a mega-switcher? have I to replace all with AJAX?


Typically this is handled by changing the hash (test.html*#foo*) in the window.location.

You can do this in conjunction with the hashchange event and window.history.pushState / replaceState You will need some sort of shim for older browsers. There is a jQuery plugin that will supposedly handle this for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号