mobile-website

Blocking device rotation on mobile web pages

南楼画角 提交于 2019-11-26 11:47:53
Is it possible to detect on my page, for example using Javascript, when user visit it using mobile device in portrait mode, and stop orientation changing when user rotate its phone to landscape? There is game on my page, optimized for portrait display only and I don't want it in landscape. New API's are developing (and are currently available)! screen.orientation.lock(); // webkit only and screen.lockOrientation("orientation"); Where "orientation" can be any of the following: portrait-primary - It represents the orientation of the screen when it is in its primary portrait mode. A screen is

How can I request an increase to the HTML5 localstorage size on iPad, like the FT web app does?

五迷三道 提交于 2019-11-26 10:28:21
问题 If you open http://app.ft.com (the Financial Times mobile web app), you are prompted to add the app to your \"home\". After doing this, when you open the app, you are prompted again to allow the localstoreage database size to be increased up to 50MB. How can this be done? Is there some JavaScript API call? Permissions or whatever? Is this iPad (iOS?) specific, or does it work on other Webkit browsers? 回答1: I happen to know something about this ;) There's no API for requesting an increase in

Strange behavior of select/dropdown's onchange() JS event when using 'Next' on Mobile Safari Dropdown list item select box

自作多情 提交于 2019-11-26 09:36:54
问题 This is a hard one to articulate and I am new to mobile web development so please bear with me: On my webpage, I have 3 Nested dropdown lists (Area, Town, Street). Nested as in, each dropdown\'s items are modified when the selection in the dropdown above it changes. e.g selecting an Area changes the Town and Street lists and selecting a Town changes the Street list. I use XMLHTTPRequests in the onchange() javascript event of the dropdowns to fetch and populate the other downdowns. This works

How to detect a long touch pressure with javascript for android and iphone?

时光怂恿深爱的人放手 提交于 2019-11-26 07:36:53
问题 How to detect a long touch pressure with javascript for android and iphone? native javascript or jquery... I want something that sound like : <input type=\'button\' onLongTouch=\'myFunc();\' /> 回答1: The problem with using Touch End to detect the long touch is it won't work if you want the event to fire after a certain period of time. It is better to use a timer on touch start and clear the event timer on touch end. The following pattern can be used: var onlongtouch; var timer; var

iOS Safari – How to disable overscroll but allow scrollable divs to scroll normally?

穿精又带淫゛_ 提交于 2019-11-26 06:54:26
问题 I\'m working on an iPad-based web app, and need to prevent overscrolling so that it seems less like a web page. I\'m currently using this to freeze the viewport and disable overscroll: document.body.addEventListener(\'touchmove\',function(e){ e.preventDefault(); }); This works great to disable overscroll but my app has several scrollable divs, and the above code prevents them from scrolling . I\'m targeting iOS 5 and above only so I\'ve avoided hacky solutions like iScroll. Instead I\'m using

Comparison between Corona, Phonegap, Titanium

家住魔仙堡 提交于 2019-11-26 03:14:54
问题 I am a web developer and I want to move my web products to iPhone. One of the products is like Google Maps: show map on the phone screen, you can drag or resize the map and view some information that we add to the map. I know there are some technologies that enables you to use HTML, CSS and Javascript to develop native iPhone apps. I\'ve identified a few: Ansca Mobile PhoneGap Appcelerator Are there other, similar products? What are the differences between them? Which should I choose? 回答1: I

Blocking device rotation on mobile web pages

末鹿安然 提交于 2019-11-26 02:35:37
问题 Is it possible to detect on my page, for example using Javascript, when user visit it using mobile device in portrait mode, and stop orientation changing when user rotate its phone to landscape? There is game on my page, optimized for portrait display only and I don\'t want it in landscape. 回答1: New API's are developing (and are currently available)! screen.orientation.lock(); // webkit only and screen.lockOrientation("orientation"); Where "orientation" can be any of the following: portrait

What is the difference between max-device-width and max-width for mobile web?

冷暖自知 提交于 2019-11-26 01:24:36
问题 I need to develop some html pages for iphone/android phones, but what is the difference between max-device-width and max-width ? I need to use different css for different screen size. @media all and (max-device-width: 400px) @media all and (max-width: 400px) What\'s the difference? 回答1: max-width is the width of the target display area, e.g. the browser max-device-width is the width of the device's entire rendering area, i.e. the actual device screen Same goes for max-height and max-device

Why are my CSS3 media queries not working?

十年热恋 提交于 2019-11-26 00:20:01
问题 In the styles.css, I am using media queries, both of which use a variation of: /*--[ Normal CSS styles ]----------------------------------*/ @media only screen and (max-width: 767px) { /*--[ Mobile styles go here]---------------------------*/ } The sites resize to the layout I want in a regular browser (Safari, Firefox) when I shrink the window, however, the mobile layout isn\'t shown at all on a phone. Instead, I just see the default CSS. Can anyone point me in the right direction? 回答1: All