url - Making jQuery bookmarkable (i.e - for a content slider) -
I have created my own custom tabbed content script and it works great. The only thing missing is that it is capable of marking different segments.
I know that the URL should be rewritten in some way. At the moment I am using default to prevent refreshing the page, it also closes by changing the URL.
I have also tried to manually rewrite the URL, but I think it should have some type of hook
Thank you in advance, Henry.
Edit: Javascript: HTML:
Store a page's history For, the most popular and full featured / supported method is using the HashanShoes, which means that you say that you yourite / page.html # page1
to yourite / page You can go through .html # page2
, you can track this change, and because we are using the hash
You can find a great way to compel a change in hash using the project
There is also a full-featured AJAX extension for it to convert your website into a full featured Web 2.0 application Allows their states / hashes to integrate Ajax requests with ease:
They both tell to provide great documentation on their demo pages whether Programming is up and running what.
Here is an example of using jQuery history (taken from demo site):
// Bind a handler for all hash / state changes $ . History.bind (function to state) // To update the current situation, tell us which states we are at current $ $. Text ('Our current situation is: [' + state + ']'); / / Update page with our current status Title end document.title = document_title + '|' state;}); // Bind a handler for state: apricot $ .History.bind ('/ apricot', function (state) {// update menu update menu (state); // Show apricot tab, hide other tabs $ tab ; $ Apricots.stop (True, True). FadeIn (200);});
and an example of jQuery Ajen (derived from the demo site):
'page': {selector: '.jaxie-page', Matches: / ^ \ / pages \ /? /, Request: function () {// login window which is being logged. Console.debug ('$. Ajaxy.configure.Controllers.page.request', [this, logic]); // menu $ adjust menu. Children ('Active') RemoveClass ('active'); // impressions content $ content.stop (true, true). FadeOut (400); // Return true true; }, Response: function () {// var Ajaxie = $ .Ajaxy; Var data = this.State.Response.data; Var state = this.state; // Log in what's happening in the window. Console.debug ('$. Ajaxy.configure.Controllers.page.response', [this, logic], data, position); // Adjust the menu menu. Children (': ([[[* * *' + State + ']]' '. AdClass (' active '). Sister (' active '). RemoveClass (' active '); // show content var Action = this; $ Content.html (Data Content). Fadein (400, Function) {Action.documentReady ($ Content);}); // Return True Really True;
And If you ever want to get query string parameters (hence the yourite / page.html # page1? Ab = 1 & ac = 2
) you can just use:
$. History.bind (function (state) {var params = state.queryStringToJSON (); // will return you {a: {b: 1, c: 2}}}
Check those demo links to see those tasks, and for all installation and usage details.
Edit: After looking at your code, you want to do this for use with Gia History.
Change:
$ ('Tabbed_content .tabs li a' ) Live ('click', function (e) {e.preventDefault (); Switch tab ($ (this))}};
To:
// Bind handle handler for all hash / state changes $ .History.bind (function (state) {switchTab (rule) E);});
Or if you plan to use jQuery history for other areas, we want to make sure that we only call the switch tab for our tabs and all the hash Do not:
// Bind a handler to change all hash / state $ .History.bind (function (state) {if ($ ('tabbed_content & gt; .content & gt; Li [id = '+ state +'] '). Length) switch tab (state);});
Now we do not use an onclick event, instead we share in the history of jQuery because it detects the hash convertibles. This is the most important concept to understand, for example, if we bookmark the site then we go back to it, we never click it. Instead we bind our clicks to hash transformations. As we click it, bookmark it, backward or forward, hash change will always fire: -)
Comments
Post a Comment