Skip to content

Commit 8fe6e18

Browse files
committed
Fixed #179 - overflow scroll not working
1 parent 8efe1f6 commit 8fe6e18

File tree

11 files changed

+52
-19
lines changed

11 files changed

+52
-19
lines changed

dist/css/ionic.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@charset "UTF-8";
12
/**
23
* Copyright 2013 Drifty Co.
34
* http://drifty.com/
@@ -2326,8 +2327,12 @@ body, .ionic-body {
23262327
-webkit-transform: scale(2, 2); } }
23272328

23282329
.overflow-scroll {
2329-
overflow: auto;
2330+
overflow-x: hidden;
2331+
overflow-y: scroll;
23302332
-webkit-overflow-scrolling: touch; }
2333+
.overflow-scroll .scroll {
2334+
position: static;
2335+
height: 100%; }
23312336

23322337
.has-header {
23332338
top: 44px; }

dist/css/themes/ionic-ios7.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@charset "UTF-8";
12
/**
23
* Nav controllers and header bar animations
34
*/

dist/js/ionic-angular.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24576,7 +24576,7 @@ angular.module('ionic.ui.content', [])
2457624576
return {
2457724577
restrict: 'E',
2457824578
replace: true,
24579-
template: '<div class="scroll-content"><div class="scroll"></div></div>',
24579+
template: '<div class="scroll-content"></div>',
2458024580
transclude: true,
2458124581
scope: {
2458224582
onRefresh: '&',
@@ -24618,9 +24618,16 @@ angular.module('ionic.ui.content', [])
2461824618

2461924619
// If they want plain overflow scrolling, add that as a class
2462024620
if($scope.scroll === "false") {
24621+
var clone = transclude($scope.$parent);
24622+
$element.append(clone);
2462124623
} else if(attr.overflowScroll === "true") {
2462224624
c.addClass('overflow-scroll');
24625+
var clone = transclude($scope.$parent);
24626+
$element.append(clone);
2462324627
} else {
24628+
var sc = document.createElement('div');
24629+
sc.className = 'scroll';
24630+
$element.append(sc);
2462424631
// Otherwise, supercharge this baby!
2462524632
var sv = new ionic.views.Scroll({
2462624633
el: $element[0].firstElementChild,
@@ -24636,11 +24643,11 @@ angular.module('ionic.ui.content', [])
2463624643
});
2463724644
// Let child scopes access this
2463824645
$scope.scrollView = sv;
24639-
}
2464024646

24641-
// Pass the parent scope down to the child
24642-
var clone = transclude($scope.$parent);
24643-
angular.element($element[0].firstElementChild).append(clone);
24647+
// Pass the parent scope down to the child
24648+
var clone = transclude($scope.$parent);
24649+
angular.element($element[0].firstElementChild).append(clone);
24650+
}
2464424651
};
2464524652
}
2464624653
};
@@ -25779,6 +25786,7 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture'])
2577925786
return;
2578025787
}
2578125788
sideMenuCtrl._handleDrag(e);
25789+
e.gesture.srcEvent.preventDefault();
2578225790
};
2578325791

2578425792
var dragGesture = Gesture.on('drag', dragFn, $element);

dist/js/ionic.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ window.ionic = {
743743
}
744744

745745
if(this.srcEvent.preventDefault) {
746-
this.srcEvent.preventDefault();
746+
//this.srcEvent.preventDefault();
747747
}
748748
},
749749

@@ -2145,6 +2145,7 @@ window.ionic = {
21452145
// Listen for drag and release events
21462146
ionic.onGesture('drag', function(e) {
21472147
_this._handleDrag(e);
2148+
e.gesture.srcEvent.preventDefault();
21482149
}, this.el);
21492150
ionic.onGesture('release', function(e) {
21502151
_this._handleEndDrag(e);
@@ -3722,6 +3723,7 @@ window.ionic = {
37223723
// Listen for drag and release events
37233724
window.ionic.onGesture('drag', function(e) {
37243725
_this._handleDrag(e);
3726+
e.gesture.srcEvent.preventDefault();
37253727
}, this.el);
37263728
window.ionic.onGesture('release', function(e) {
37273729
_this._handleEndDrag(e);
@@ -4612,9 +4614,9 @@ ionic.controllers.NavController = ionic.controllers.ViewController.inherit({
46124614
this._rightShowing = false;
46134615

46144616
// Push the z-index of the right menu down
4615-
this.right && this.right.pushDown();
4617+
this.right && this.right.pushDown && this.right.pushDown();
46164618
// Bring the z-index of the left menu up
4617-
this.left && this.left.bringUp();
4619+
this.left && this.left.bringUp && this.left.bringUp();
46184620
} else {
46194621
this._rightShowing = true;
46204622
this._leftShowing = false;

js/ext/angular/src/directive/ionicContent.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ angular.module('ionic.ui.content', [])
2222
return {
2323
restrict: 'E',
2424
replace: true,
25-
template: '<div class="scroll-content"><div class="scroll"></div></div>',
25+
template: '<div class="scroll-content"></div>',
2626
transclude: true,
2727
scope: {
2828
onRefresh: '&',
@@ -64,9 +64,16 @@ angular.module('ionic.ui.content', [])
6464

6565
// If they want plain overflow scrolling, add that as a class
6666
if($scope.scroll === "false") {
67+
var clone = transclude($scope.$parent);
68+
$element.append(clone);
6769
} else if(attr.overflowScroll === "true") {
6870
c.addClass('overflow-scroll');
71+
var clone = transclude($scope.$parent);
72+
$element.append(clone);
6973
} else {
74+
var sc = document.createElement('div');
75+
sc.className = 'scroll';
76+
$element.append(sc);
7077
// Otherwise, supercharge this baby!
7178
var sv = new ionic.views.Scroll({
7279
el: $element[0].firstElementChild,
@@ -82,11 +89,11 @@ angular.module('ionic.ui.content', [])
8289
});
8390
// Let child scopes access this
8491
$scope.scrollView = sv;
85-
}
8692

87-
// Pass the parent scope down to the child
88-
var clone = transclude($scope.$parent);
89-
angular.element($element[0].firstElementChild).append(clone);
93+
// Pass the parent scope down to the child
94+
var clone = transclude($scope.$parent);
95+
angular.element($element[0].firstElementChild).append(clone);
96+
}
9097
};
9198
}
9299
};

js/ext/angular/src/directive/ionicSideMenu.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture'])
6868
return;
6969
}
7070
sideMenuCtrl._handleDrag(e);
71+
e.gesture.srcEvent.preventDefault();
7172
};
7273

7374
var dragGesture = Gesture.on('drag', dragFn, $element);

js/ext/angular/test/sideMenu.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
<button class="button button-icon" ng-click="openLeft()"><i class="icon ion-navicon"></i></button>
1919
<h1 class="title">Slide me</h1>
2020
</header>
21-
<div class="content has-header">
21+
<content has-header="true">
2222
<h1>Content</h1>
23-
</div>
23+
</content>
2424
</pane>
2525
<side-menu side="left">
2626
<header class="bar bar-header bar-assertive">
2727
<h1 class="title">Left</h1>
2828
</header>
29-
<content has-header="true">
29+
<content has-header="true" overflow-scroll="true">
3030
<ul class="list">
3131
<a href="#" class="item" ng-repeat="item in list">
3232
{{item.text}}

js/utils/gestures.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@
441441
}
442442

443443
if(this.srcEvent.preventDefault) {
444-
this.srcEvent.preventDefault();
444+
//this.srcEvent.preventDefault();
445445
}
446446
},
447447

js/views/scrollView.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
// Listen for drag and release events
107107
ionic.onGesture('drag', function(e) {
108108
_this._handleDrag(e);
109+
e.gesture.srcEvent.preventDefault();
109110
}, this.el);
110111
ionic.onGesture('release', function(e) {
111112
_this._handleEndDrag(e);

js/views/slideBoxView.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
// Listen for drag and release events
3131
window.ionic.onGesture('drag', function(e) {
3232
_this._handleDrag(e);
33+
e.gesture.srcEvent.preventDefault();
3334
}, this.el);
3435
window.ionic.onGesture('release', function(e) {
3536
_this._handleEndDrag(e);

scss/_scaffolding.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,15 @@ body, .ionic-body {
155155
}
156156

157157
.overflow-scroll {
158-
overflow: auto;
158+
overflow-x: hidden;
159+
overflow-y: scroll;
159160
-webkit-overflow-scrolling: touch;
161+
162+
.scroll {
163+
position: static;
164+
height: 100%;
165+
166+
}
160167
}
161168

162169
// Pad top/bottom of content so it doesn't hide behind .bar-title and .bar-tab.

0 commit comments

Comments
 (0)