jQuery UI Widgets › Forums › Navigation › Menu, Context Menu › Menue disappears when loading into iframe
This topic contains 8 replies, has 2 voices, and was last updated by Peter Stoev 12 years, 4 months ago.
-
Author
-
Hi Peter,
we have a strange problem concerning loading pages into an iframe with jqWidgets. The menue is loading the pages iframe1.html and iframe2.html into an iframe. Most of the time everything is working fine. The pages are loaded into the iframe. But after selecting both menue points cyclic for a time, the main page dissapears and only the iframe page is loaded. Heres is a demo page: http://85.214.211.237/jqw/main.html demonstrating the behaviour.
This is very urgent, because our customers complain about vanishing menues.
Best Regards
KarlheinzHi Karlheinz,
Actually, the Menu does not disappear. When the menu item is clicked, the browser navigates to the IFrame’s page. The solution is to use the ‘itemclick’ event for switching the IFrame’s src.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
why does the browser navigate most of the times to the main page and sometimes to the iframe ? Why can we not use the target in the menue items and why is ‘itemclick’ better ?
Best Regards
Karlheinz RafalskiHi Karlheinz,
‘itemclick’ should be used if you want to load content within the same page. If you want to navigate to different pages, use anchor tags.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
how do you explain, that it does only happen when we use jqxMenu. Habe a look now at the demo page, where I removed the jqxMenu line. No more navigation to the iframes’s page: http://85.214.211.237/jqw/main.html .
Best Regards,
Karlheinz RafalskiHi Karlheinz,
Please, use the provided solution in my previous post in case you want to use jqxMenu. The ‘itemclick’ event should be used if you want to load content within the same page. If you want to navigate to different pages, use anchor tags instead.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
okay, I am trying to use the ‘itemclick’ event. So I give every menue element an ID like … . In the ‘itemclick’ event I do
if(event.args.id==’m1′)
{
// load page belonging to m1 into iframe
}
else if(event.args.id==’m2′)
{
// load page belonging to m2 into iframe
}
etc.Is there a more elegant way to do this ?
Best Regards
Karlheinz RafalskiHi Peter,
I would like to inform you, how we solved it in the end. We removed all href’s and target’s from the menue items and added a ‘data-url’ attribute:
<li><a data-url="/page1.aspx">Page 1</a></li>
In the itemclick event we read the data-url attribute and set the iframe’s source:
$("#menue").bind('itemclick', function (event) { var url = $(event.target).attr("data-url"); $("#iframe").attr('src', url);});
Best Regards,
Karlheinz RafalskiHi Karlheinz,
Thanks for the update!
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.