简体   繁体   中英

jquery datepicker in jquery-mobile popup, first touch is triggering select options to display in iOS

I have a PhoneGap(v.4.2.0-0.25.0)/jQuery-Mobile(v1.4.5) app for iOS. I am using the jquery datepicker widget (jquery-ui-1.11.3) within a jQuery-Mobile popup. The problem I have is that when I touch anywhere on the calendar, it displays the month select options. I have the 'changeMonth' and 'changeYear' options enabled. I believe that this is somehow related to the jQueryMobile popup because when I simply display the datepicker on the page, outside of the popup, this issue does not happen.

The following is my popup snippet:

<div data-role="popup" id="sblCalendarPopup" data-history="false">
    <div id="sblCalendar"></div>
</div>

When I disable the 'changeMonth' and 'changeYear' options, there are no select options to display. I would appreciate any insight into why this may be happening.

Since I do not want this odd behavior happening for any of my jQuery Mobile popups, I found a workable solution from the post: jQuery Mobile Select Menu open on tap anywhere in Popup ... in jquery.mobile-1.4.5.js I simply commented out the following lines in _openPrerequisitesComplete():

if ( firstFocus.length > 0 ) { this._ui.focusElement = firstFocus; }

or in jquery.mobile-1.4.5.min.js, comment out:

c.length>0&&(this._ui.focusElement=c),

This seems to work for me so far. I can now use the fully functional jQuery UI datepicker widget.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM