Init

Init all components in a page with $.init().

We will not init page on document loaded, because $.config.autoInit = false;. You should call $.init() on document loaded. $.init method will init all components in page, and trigger a pageInit event after init complete. You should call $.init after all pageInit events has binded.

But the page Loaded By router will always be inited.

Do not modify $.init please.

If you set $.config.autoInit = true;, the $.init method will auto be called after document onload. But your pageInit binds may have not executed at this time. So, please do not set autoInit=true, unless you don't listen to pageInit event or you can make sure that your code will be right.

see demos for more usage.

global config

You can set $.config before light7.js to change some default config:

Note! autoInit is false in default config.

{% highlight html %} {% endhighlight %} all available config:
name default description
autoInit false Auto call $.init after document.onload
router true Use router to load new page. The router will listen all links events and will prevent links' default behavior and use ajax to load new page
showPageLoadingIndicator true Show indicator when router is loading new page。Available only when router is true
swipePanel "left" Swipe to open a panel
swipePanelOnlyClose true Only Swipe to close panel, but can't swipe to open a panel