mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-18 21:30:59 +00:00
Clarified the documentation around the purpose of the pagebeforecreate event and removed the pagebeforecreate return value check, as returning beforecreate false is no longer relevant now that all plugins auto-init externally, rather than inline in the page plugin.
This commit is contained in:
parent
10e2d5a61a
commit
6de76168af
2 changed files with 6 additions and 9 deletions
|
|
@ -106,18 +106,17 @@ $('div').live('pagehide',function(event, ui){
|
|||
<dl>
|
||||
<dt><code>pagebeforecreate</code></dt>
|
||||
<dd>
|
||||
<p>Triggered on the page being initialized, before initialization occurs.</p>
|
||||
<p>Triggered on the page being initialized, before most plugin auto-initialization occurs.</p>
|
||||
<pre><code>
|
||||
$('#aboutPage').live('pagebeforecreate',function(event){
|
||||
alert('This page was just inserted into the dom!');
|
||||
});
|
||||
</code></pre>
|
||||
<p>Note that by binding to <code>pagebeforecreate</code> and returning <code>false</code>, you can prevent the page plugin from making its manipulations.</p>
|
||||
<p>Note that by binding to <code>pagebeforecreate</code>, you can manipulate markup before jQuery Mobile's default widgets are auto-initialized. For example, say you want to add data-attributes via JavaScript instead of in the HTML source, this is the event you'd use.</p>
|
||||
|
||||
<pre><code>
|
||||
$('#aboutPage').live('pagebeforecreate',function(event){
|
||||
//run your own enhancement scripting here...
|
||||
return false;
|
||||
// manipulate this page before its widgets are auto-initialized
|
||||
});
|
||||
</code></pre>
|
||||
</dd>
|
||||
|
|
|
|||
|
|
@ -15,11 +15,9 @@ $.widget( "mobile.page", $.mobile.widget, {
|
|||
|
||||
_create: function() {
|
||||
|
||||
if ( this._trigger( "beforeCreate" ) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.element.addClass( "ui-page ui-body-" + this.options.theme );
|
||||
this._trigger( "beforecreate" );
|
||||
|
||||
this.element.addClass( "ui-page ui-body-" + this.options.theme );
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue