Can't prevent `touchmove` from scrolling window on iOS
I recently ran into this same problem. You'll need to pass { passive: false }
when registering the touchmove
event listener. e.g.
document.addEventListener('touchmove', function(e) {
e.preventDefault();
}, { passive: false });
This is because document touch event listeners are now passive by default in Safari 11.1, which is bundled with iOS 11.3. This change is documented in the Safari 11.1 release notes:
Web APIs
- [...]
- Updated root document touch event listeners to use passive mode improving scrolling performance and reducing crashes.
Ionic 2 - How do I disable scrolling
To fix it, you should understand what's causing it, so you probably want to read this
.
In some special cases, you might be able to hide that white space by disabling scrolling, but that's really not how you should approach this issue.
Instead, you should just remove the white space. You can do it by applying
display: block;
... or ...
float: left;
width: 100%;
height: auto;
to your <img>
element.
As an alternative, you can change your markup to:
<ion-content>
<img class="bgc" src="assets/background.png"
/></ion-content>
Related Topics
Node.Js Document Is Not Defined
How to Load a Font File in Vuejs and Webpack
Json.Stringify Without Quotes on Properties
Warning: Failed Proptype: Invalid Prop 'Component' Supplied to 'Route'
How to Use Fetch Within a For-Loop, Wait for Results and Then Console.Log It
How to Let a User Download Multiple Files When a Button Is Clicked
Html Anchor Tag With JavaScript Onclick Event
How to Update Component State on Redux State Change
Document.Queryselector Always Returns Null
How to Remove Image from Browser Cache
How to Put a Variable in an Src Attribute
How to Remove a Parameter from a Url
Detect If Page Is Load from Back Button
Disabled Button Onclick Event Fires
How to Do Validation for 10 Digit Mobile Number Using Jquery
Why Is It a Bad Practice to Return Generated HTML Instead of Json or Is It
Hosting Your Own JavaScript Scripts Files (Other Than Jquery) on Fast Free Cdns Like Google