last day (14 days later) » 

11:47 AM
0
Q: Inserting dynamic panel jquery mobile

Opolo WebdesignIn my app I would like to re-use the panel so I call this function when opening index.html: var add_panel=function() { //add button $('[data-role="header"]').append('<a href="#leftpanel" class="ui-btn ui-icon-bars ui-btn-icon-notext ui-corner-all ui-btn-left">Menu</a>'); //panel $.get('panel.ht...

 
pagecontainertransition will fire on each and every page, this will result in duplicate panels. if you visit the same page 3 times, you'll have 3 panels. Also, you'll have all panels in all pages with same id. stackoverflow.com/a/16414517/1771795
 
I had hoped to solved the double panels issue with $("#leftpanel").remove(); within the function but this results in the panel not beeing on the first page when I return
 
why do you need to append and then remove panels?
 
To avoid double panels. I looking for a way to have to use only on html file and not insert the menu on each page. Can this be done?
 
11:47 AM
I'm using pagecontainertransition because my app has multiple page. The example doesn't?
he
 
multi-page or single, it should work
hi @OpoloWebdesign
 
so i shoud replace pagecontainertransition by pagecreate?
 
it depends
you want to use the same panels for all pages?
or different panels for different pages?
 
for now same panel for all pages
 
easy
3
A: Restrict JQM Panel to only 1 instance on page

OmarThe pagebeforecreate event will emit on each and every page, but only ONCE. If you have 5 pages in one HTML file (Multi-Page Model), that event will fire 5 times before creating/showing the target page. This event can't be delegated to a specific page, e.g. the below code won't work. $(document...

go to Alternative approaches number 2
external panel can be accessed from any page
whether your application is multi or single
 
11:51 AM
ok, let me try that
 
@OpoloWebdesign here's a write up jqmtricks.wordpress.com/2014/04/13/dynamic-panels
 
cool, progress
thanks
 
welcome :)
 

last day (14 days later) »