Prevent iOS bounce without disabling scroll ability
This code should stop the bounce as it's the HTML tag that bounces
html {
height : 100%;
overflow: hidden;
position: relative;
}
body {
height : 100%;
overflow: auto;
position: relative;
}
iOS Safari - disable scroll / bounce but retain zoom
I managed to solve this issue by listening to some values on the touch event object, specifically changedTouches.length
and scale
.
First I set a global variable for zoomLevel at the top of the document var zoomLevel = 1
Next, I replaced evt.preventDefault()
in iNoBounce with:
if(evt.changedTouches.length === 1 && zoomLevel <= 1){
evt.preventDefault();
}
if(evt.changedTouches.length > 1){
zoomLevel = evt.scale;
}
This looks at how many fingers are being used and if the page scale is not 100%, then acts accordingly.
Disable content bouncing scroll
You will need to set overflow-scroll
to false
like :
overflow-scroll="false"
Works on Ionic 1.3
Related Topics
Allow Certain Style Attributes with Ngsanitize
Is It Possibly to Keep Vertical Rhythm Using Only CSS
Get Actual Pixel Coordinates of Div After CSS3 Transform
Saving Dropdown Menu Selection in a Cookie
Retrieving or Changing CSS Rules for Pseudo Elements
Calculate Absolute Dimensions of a Div Rotated in Perspective with CSS3
Elements Positioned Relatively Don't Move When the Dom Is Updated (IE6 and IE7)
Modify Pseudo Select :After in JavaScript
Highcharts.Js - Background Color of Axis Only
Determine If Point Is Within Bounding Box
Changing Textbox Border Colour Using JavaScript
Make :Focus Change CSS of Another Class
How to Get Default Font Size in Pixels by Using JavaScript or Jquery
Jquery Word for Word Fade in Effect
Why Do Developers Append a Query String in JavaScript Files' Stylesheet Links