overflow-x:hidden does not work on mobile devices - javascript

I built a one-page site which works fine, except for one thing (on mobile devices), which is the overflow-x:hidden.
I use <meta name="viewport" content="width=device-width, height=device-height"/>.
and when I searched I find this issue
so I create site wrapper div inside the body and applying the overflow-x:hidden to the wrapper. but still have problem in mobile and tablet device.
my website is here.

Works fine for me too on Samsung galaxy s5. Might sound silly but it isn't just cached on your devices is it since before you added the wrapper and overflow-x: hidden? I had to clear my phone cache a lot when I was updating my site recently.

Related

How do I get the viewport meta tag to work correctly on my responsive site?

I'm setting up a website www.bytework.dk.
I've added the viewport meta tag, which usually always works fine for me, so the site looks right on smartphones. But for some reason, this site ignores it completely and the site is zoomed out to full size on mobile.
I've checked all the javascript code, I've checked the CSS. I have no idea why the hell it has no function?
Whatever settings I try with the viewport meta tag it has absolutely no effect on the appearance of the page on a smartphone???
This is the code I'm using:
<meta name="viewport" content="width=device-width, initial-scale=1">
EDIT: Seems the problem is related to some dns settings on the domain provider I'm using and the shitty solution they made.
try to open it in an incognito window (if you're using Google Chrome) and see if that's still happening or clean up your cache, restart your browser and try again.

How to prevent mobile scrolling on double tap in PhoneGap?

I'm using AppGyver's SteroidsJS (essentially PhoneGap with enhanced performance and Native UI) to create a web app. I noticed that when I double tap on an element, it will scroll to that element, even if I have disabled WebView overscroll. This is a problem, because if the WebView content is shorter than the screen size, I can't even scroll back up. Is there a fix for this? Thanks!
There has been some discussion of PhoneGap's tap delay and double-tap problem. For example, check this StackOverflow thread: Phonegap iOS app screen slides up on double tap
I have been trying to figure this out as well, and here are some approaches that I have tried:
IOS This is specifically for IOS. Try modifying your /config.xml file to change "DisallowOverscroll" to true.
<preference name="DisallowOverscroll" value="true" />
HTML solution: This could be a solution to a single page web-app. Check your app's viewport meta tag. Common convention is to infer the viewport width and height from device, for example
<meta name="viewport" content="width=device-width, height=device-height"> I have found that this allows some additional space in the browser area. Hard-coding the screen size of device solved this problem for me. For example, <meta name="viewport" content="width=1024, height=768">
Add same dimensions to any canvas element on the html page.<canvas width=1024, height=768" ...> This approach seems to be working, at least on my iPad.
Javascript/JQuery: The StackOverflow link above talks specifically about the jQuery approach. That means effectively interpret the double-tap event using this gist: https://gist.github.com/johan/2047491 and then call the event handler appropriately from your webapp, e.g. $("body").nodoubletapzoom(); I haven't had much of a success with this.

Impossible to hide navigation bars in Safari iOS 7 for iPhone/iPod touch

I don't believe there is any solution to hide bars programmatically using javascript/css/html, but let me try to describe a problem. We are the team of mobile game developers and we have been developing a game for one year.
After iOS 7 announcement we have faced the problem that it is IMPOSSIBLE to hide the navigation bars. Once user taps in the upper or lower part of the Safari browser, navigation bars are appearing again and hide all controls of the game.
The only solution we have found so far is forcing user to:
Rotate device
Scroll the page
Add application to Home-screen
None of these alternatives is acceptable. It looks like Apple is aware of this problem, but keeps ignoring it. They have closed a reported bug as a duplicate of the bug #14076889.
I believe that we are not the only team who experience the same problem. Does anyone know the solution?
Update September 2014: iOS 8 has removed the minimal-ui feature
There's again no way to remove/hide navigation bars other than to rely on the default browser behavior (bars will be hidden when scrolling, but only if the scrolling element is the BODY of the page). The only "workaround" is to save the app to the homescreen and have the proper meta tags set (see below).
Update August 2014: iOS 8 (beta) no longer supports minimal-ui.
There's no workaround. (The reason for this is likely due to abuse by websites that used it to try to prevent people from navigating away, tho there may be new features in iOS 8 Safari that have not been made public yet that replace minimal-ui.)
iOS 7.1 added a new API to solve this problem:
<meta name="viewport" content="minimal-ui">
This new viewport flag hides the Safari UI by default (only a small title bar with URL and SSL indicator are shown). To access the Safari UI, users must actively tap this title bar.
Note that on iOS 7.0.x, there's no API or known workaround for this. In those versions, if you want to hide Safari's browser chrome permanently you need to either get the user to add the web app to the home screen (with the appropriate meta tags set <meta name="apple-mobile-web-app-capable" content="yes">) or use some sort of native app wrapper like Phonegap and distribute via the App Store.
Personally, I wish they hadn't removed the "full screen" button they introduced in landscape mode on iOS 6 Mobile Safari, which was a great solution that made developers and users happy.
A perfect candidate for this to be solved more permanently would be for Mobile Safari to support the HTML5 full screen API (which is supported on Safari on OS X!). Alas, there's no support right now and historically iOS point releases didn't add new Safari features, so maybe that's something for iOS 8.
UPDATE: There is a meta property for fixing this currently in iOS7.1 Beta according to this forum post on the release notes.
<meta name="viewport" content="minimal-ui">
I have run a test and can confirm this feature is currently in Beta 2.
NOTE: The new minimal-ui option is a great solution but it needs to be part of the HTML response.
I tried on iOS7.1 beta3 to append the viewport meta tag with JS
$('head').append('<meta name="viewport" content="width=device-width, user-scalable=0, minimal-ui">');
the value "minimal-ui" is ignored by the browser.
Update: iOS7.1 has now been released so the NDA has lifted.
<meta name="viewport" content="minimal-ui">
Is indeed the correct tag and works in the live release. Remember that "viewport" can support a comma separated list if you require.
I combine it with other mobile variables to make the website feel like an app:
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimal-ui">
-
We have been struggling with this one too. We have a TabBar on our site and every time you attempt to click a tab safari controls pop up.
Today hope. If you are a member of the apple developer program, I would strongly suggest visiting this forum: https://devforums.apple.com/message/927476
W
EDIT 2:
Does not work since iOS 7.1
EDIT:
Some games have adopted an overlay that hints the player to scroll away the bars and then locks scrolling until bars pop out again. In this case position: fixed helps a lot, as it stabilizes the movement (can't explain it better, just have to try it for yourself). This game is a good example of such approach:www.paf.com/mobile/launch/flowers.html (sorry, can't post more than 2 links)
Recently I have also stumbled upon a hack that deactivates navigation bar triggering for the top area. All you have to do is add a random element to your DOM with following styles:
z-index: 100000; /* should be bigger than everything else */
position: fixed;
overflow: scroll;
-webkit-overflow-scrolling: touch;
Read more about it here.
If you are creating a web-app, you can create a link to the URL from the home screen; and use the following HTML Meta Tags:
<!-- Allows fullscreen mode from the Homescreen -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Sets the color of the text/battery, wireless icons etc -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
This will super-impose the indicators over your header/nav bar. (The indicators you see on all the iPad screens.
For more info, see:
https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html
Hopefully this helps someone, but I didn't want to set my viewport width=device-width.. because its 480px on iphone 4.. and I want my game to be at 800px for all devices.
And if you don't set it, then minimal-ui doesn't register.
My work around is doing:
<meta name="viewport" content="width=device-width, minimal-ui">
And then changing the viewport once the page is loaded:
$(window).load(function(){
$('meta[name=viewport]').attr('content','width=800, maximum-scale=1')
});
I'm pretty shocked it works. The address bar and lower UI buttons only appear if the user clicks the top/bottom of the screen. Love it now.
This solution worked for me, but in my case, the webapp was for
a private public, where I had control of the Ipad that would be used.
I tried to use all possible meta tags and hacks, and really, after
IOS8 have removed the minimal-ui feature, was practically impossible to solve.
Thinking outside the box, our team reached a nice solution:
The Mercury browser opens in fullscreen, and even when pages
are being charged, the address bar does not appear.
It is a small icon on the bottom right and only :)
It worked perfectly for our problem!
But I repeat: do not use it if you are developing a webapp for the public in general.
It's terrible for the UX force your user to download a different browser
to access the app.
UPDATE
A developer friend of mine came up with this solution:
Use a webview inside of Titanium from appcelerator.
It won't be aproved on Apple store, but for a private event, it'll work just fine!

iOS 6: Safari overflow: hidden on containing div not working when modal open

I can't seem to use overflow: hidden trick on the body of my website in order to lock the background content when a modal is open.
I'm applying the current styles onto the body:
$('body').css({'overflow':'auto', 'position':'static'});
And they are being successfully applied, it works fine in Android, the background content locks, however in iOS devices, this doesn't work and the content background content is still scrollable. Any idea what would cause this?
This is the meta viewport tag I am using:
<meta name="viewport" content="width=device-width, maximum-scale=1">
iOS6 Webview requires overflow hidden on both the html and body element to work correctly. If someone wants to add it to the webkit bug tracker I'd be much obliged :).
Either this or the question here should be marked as duplicate.

jQuery Mobile Beta 1 now shows the page as a normal website in mobile browsers?

I have today updated to jQuery Mobile Beta 1 and now in my mobile (Android) and even some iPhone i tested on the page is shows like in my desktop browser = need to zoom to read stuff.
I can not find that they changed anything about how it works with that?
Its worked fine in latest alpha before i updated.
jQuery Mobile is not inserting the meta viewport tags by default anymore. you have to insert it yourself.
See: Dynamic injected viewport meta tag: Support dropped in the release notes
As a follow-up the meta tag that needs to be inserted is:
<meta name="viewport" content="width=device-width, initial-scale=1">

Categories

Resources