vbd
vbd

Reputation: 3557

jQuery/Javascript will chaining be the solution?

dummy.html:

<button id="do">Do</button>

external.js:

$("#do").click(function() {
  history.go(-1);
  alert('One page back');
  history.go(1);
  alert('back from were you started');
});

Will execute history.go(-1); and end.

In the final usage scenario it will be used with jQuery UI tabs consisting of several tabs, and normally history.go(-1) will stay on same page but normally return to another tab, on the same page.

Can I solve this with chaining and how would it look like?

Upvotes: 0

Views: 58

Answers (2)

Rick
Rick

Reputation: 1573

Here's something that might help you. This uses an array to push/pop a history for the tabs.

http://jsfiddle.net/wgxjz/6/

Edit: It's not bulletproof, but it's something to go on.

Upvotes: 0

Naftali
Naftali

Reputation: 146360

history.go(...) leaves the current page and any js running on it will stop.

Upvotes: 2

Related Questions