Search code examples
javascriptjqueryjquery-uiiframejquery-ui-layout

jQuery UI layout closed panel renumbers iframes


Simple question from a newbie: how do I have jQuery UI layout revert to the original iframe numbering after panels have been closed and reopened? E.g., I have 3 panels with iframes in each. Page links in the files in the first two iframe panels are connected such that a link in one will trigger both; e.g., in iframe page 1:

<a href="#p2" title="to page 2" onclick="parent.window.frames[1].location.href='iframepage2.html#p2'; return true;">▽</a>

is to send both iframe panels 1 and 2 to the second page. But when the second iframe panel is closed, the third iframe panel becomes "frames[1]", making it the target of iframe panel 1. Iframe panel 1 links will not target panel 2 again until the third panel is opened+/closed.

Is there a simple way to force particular panels to be associated with particular iframe numbers regardless of whether they're open or not? Or a way to automatically have the iframe numbering revert to the original panels (as on load)? Reloading (if it sends to top) is undesirable in this case, as it sends us to a different page in the doc. Thanks.


Solution

  • For future reference, the answer is here. Use, e.g.:

    <a href="#p2" title="to page 2" onclick="window.open('iframepage2.html#p2', 'page1ID'); return true;">▽</a>