当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - How do I change the default change event reload option?

问题描述:

JQueryMobile 1.4 is auto-enhancing my anchor links and fetching their content through AJAX. In some cases, I would like for these anchor links to cause a reload if the link is to the same page the user is currently on. If I controlled the call to changePage, then I could specify reloadPage = true, but JQueryMobile doesn't seem to expose this option for enhanced anchors. I tracked down this logic to these lines in the load function of pagecontainer:

_loadDefaults: {

[...]

// DEPRECATED

reloadPage: false,

reload: false,

[...]

settings = $.extend( {}, this._loadDefaults, options ),

[...]

settings.reload = settings.reloadPage;

[...]

// If the content we are interested in is already in the DOM,

// and the caller did not indicate that we should force a

// reload of the file, we are done. Resolve the deferrred so that

// users can bind to .done on the promise

if ( content.length && !settings.reload ) {

https://github.com/jquery/jquery-mobile/blob/master/js/widgets/pagecontainer.js

How do I change _loadDefaults? The object isn't underneath $.mobile.pageContainer.pagecontainer.

This works if I manually update reloadPage to true in JQM source. I am just looking for how I can do the same without modifying JQM source. Thanks!

分享给朋友:
您可能感兴趣的文章:
随机阅读: