I want to include a static height / width google map element inside my tab <content> area but I don’t want to enable a rubber-band effect or show scroll bars. How do I go about this?
I tried overriding .scroll css rule with width: 100% and height:100%. This worked but definitely isn’t a good practice.
How about a content attribute that disables rubber-band scrolling, and another supporting facilitating full-width / full-height content?
Hey @credli, did you try setting <content scroll="false">? That will disable scrolling. Take a look at the examples/starters/map for a full screen map example.
Here’s an idea for a hack: add a transparent overlays and capture all interaction events. Allow click throughs and whatever other events you need to, but disable vertical drags.
I’d also need this…
I am building a directive where an element is only allowed to be dragged horizontally. However, a vertical drag results in unwanted scrolling of the ion-content page.
There should be a better solution than @peey’s hack.
This is a dirty and terrible hack. It’s laggy and buggy but maybe helps someone. The idea is to detect the vertical scrolling position and scroll the element to that same position, when horizontal drag is detected on an element.
So, this example would disable vertical scrolling, when .horizontally-swiped-element notices horizontal dragging. Here is the HTML stuff…
…and here is the function to disable vertical scrolling, called from the HTML when on-drag-left and on-drag-right are triggered. This can be placed in the controller. And yeah, you can make it directive if you want.
Any ideas how to improve this workaround’s performance are welcome. Anyway, disabling scrolling shouldn’t happen by scrolling, and it’s what this hack is all about.
I guess that many of us would like to create mobile-Netflix-like UI with horizontally scrolled and dragged elements, so let’s hope someone skillful enough implements the goal of these workarounds as a feature, the way this should be done.
In my testing the following disables scrolling (both scrollingY and scrollingX are possible) until it is explicitly re-enabled, i.e. you only have to call it once onTouch and then re-enable onRelease.
I have tried several options with .freezeScroll(true) on a Directive and Controllers and never got it working correctly. However this option works directly out of the box!!
My usecase for this was having a signature pad and preventing scroll while signing. If scrolling was enabled, the signature functionality was basically unusable.
Anyway, $ionicScrollDelegate.freezeAllScrolls(true/false); worked for me.