Tuesday 15 September 2015

jQuery + Ajax Hash / History and more -


I am trying to use URL hash in jQuery to control history in Ajax and links / page book - Make markable I have tried to exclude almost every plug-in, and I think that nobody can take it to work properly, so I do not really have any code example but I have any suggestions, suggestions, Open to tutorials, etc.

The difference on one of those pages which I am trying to include is that I have a jQuery animation driven splash / loading page, which is also the same page in which all content load Will.

.. and on this link, I want to pass by all the splash / loading animation and want to load content directly based on the hash value / string (in this case, #home) .

I was trying to understand this one for a while, any help is appreciated, thanks!

What problem do you have? Set the hash tag or handle the change of the hash?

By setting the hashes, it is just a question of putting a hash in the link, for example & lt; A href = "www.voidsync com / 2010 / # page" & gt; Link & lt; / A & gt; But I think this is not your problem.

To do something really with a hash, you should have a listener function, for example hash has changed every 100 mms and works accordingly. A simple task can be:

  $ (function () {var current_hash = false; set interval (function () (if (window.location.hash! = Current_hash) { Current_hash = window .location.hash; $ ('# content'). Load ("content.php? Page =" + current_hash);}}, 100);});  

The hash has changed, if this (untested) function will check every 100ms, and if it is, then the page will be updated through Ajax.

This function also works Load the page, So if a user like page www.voidsync.com/2010/#images If the screen comes from the page, the function will automatically load the 'images'. Then history and bookmarks work.

Hope that helps, just ask if you meant something else. / P>


No comments:

Post a Comment