diff --git a/dist/css/ionic-ios7.css b/dist/css/ionic-ios7.css index 442572e9af..1f0d81fb0b 100644 --- a/dist/css/ionic-ios7.css +++ b/dist/css/ionic-ios7.css @@ -370,8 +370,7 @@ body, .ionic-body { .content { position: absolute; width: 100%; - top: 0; - bottom: 0; + height: 100%; overflow: auto; -webkit-overflow-scrolling: touch; } @@ -548,6 +547,14 @@ address { border-bottom-width: 1px; } .bar.bar-footer { border-top-width: 1px; } + .bar.bar-clear { + background: none; + color: #fff; + border: none; } + .bar.bar-clear .button { + color: #fff; } + .bar.bar-clear .title { + color: #fff; } .bar.bar-default { background-color: rgba(255, 255, 255, 0.9); border-color: #dddddd; diff --git a/dist/css/ionic-scoped.css b/dist/css/ionic-scoped.css index 73ed860a9d..d81c602258 100644 --- a/dist/css/ionic-scoped.css +++ b/dist/css/ionic-scoped.css @@ -1142,8 +1142,7 @@ .ionic .content { position: absolute; width: 100%; - top: 0; - bottom: 0; + height: 100%; overflow: auto; -webkit-overflow-scrolling: touch; } .ionic .has-header { @@ -1316,6 +1315,14 @@ border-bottom-width: 1px; } .ionic .bar.bar-footer { border-top-width: 1px; } + .ionic .bar.bar-clear { + background: none; + color: #fff; + border: none; } + .ionic .bar.bar-clear .button { + color: #fff; } + .ionic .bar.bar-clear .title { + color: #fff; } .ionic .bar.bar-default { background-color: rgba(255, 255, 255, 0.9); border-color: #dddddd; diff --git a/dist/css/ionic.css b/dist/css/ionic.css index 07adc11c7a..4f37073687 100644 --- a/dist/css/ionic.css +++ b/dist/css/ionic.css @@ -1449,8 +1449,7 @@ body, .ionic-body { .content { position: absolute; width: 100%; - top: 0; - bottom: 0; + height: 100%; overflow: auto; -webkit-overflow-scrolling: touch; } @@ -1657,6 +1656,14 @@ address { border-bottom-width: 1px; } .bar.bar-footer { border-top-width: 1px; } + .bar.bar-clear { + background: none; + color: #fff; + border: none; } + .bar.bar-clear .button { + color: #fff; } + .bar.bar-clear .title { + color: #fff; } .bar.bar-default { background-color: rgba(255, 255, 255, 0.9); border-color: #dddddd; @@ -3242,6 +3249,14 @@ a.button { -webkit-transition: opacity 0.4s ease-in; opacity: 1; } +/** + * Scroll is the scroll view component available for complex and custom + * scroll view functionality. + */ +.scroll { + position: absolute; + width: 100%; } + .nav-content { position: absolute; width: 100%; diff --git a/dist/js/ionic-angular.js b/dist/js/ionic-angular.js index abefa986ca..661736e8b5 100644 --- a/dist/js/ionic-angular.js +++ b/dist/js/ionic-angular.js @@ -346,6 +346,9 @@ angular.module('ionic.ui.content', []) return function($scope, $element, $attr) { var c = $element.eq(0); + if(attr.padded) { + c.addClass('padding'); + } if(attr.hasHeader) { c.addClass('has-header'); diff --git a/dist/js/ionic.js b/dist/js/ionic.js index 07b742e7d6..ddddfb481f 100644 --- a/dist/js/ionic.js +++ b/dist/js/ionic.js @@ -2480,6 +2480,92 @@ window.ionic = { } }; +})(ionic); +; +(function(ionic) { +'use strict'; + + ionic.views.Scroll = function(opts) { + var _this = this; + + // Extend the options with our defaults + ionic.Utils.extend(opts, { + decelerationRate: ionic.views.Scroll.prototype.DECEL_RATE_NORMAL + }); + + this.el = opts.el; + this.decelerationRate = opts.decelerationRate + + // Listen for drag and release events + window.ionic.onGesture('drag', function(e) { + _this._handleDrag(e); + }, this.el); + window.ionic.onGesture('release', function(e) { + _this._handleEndDrag(e); + }, this.el); + }; + + ionic.views.Scroll.prototype = { + DECEL_RATE_NORMAL: 0.998, + DECEL_RATE_FAST: 0.99, + + _initDrag: function() { + this._isDragging = false; + this._drag = null; + }, + + /** + * Initialize a drag by grabbing the content area to drag, and any other + * info we might need for the dragging. + */ + _startDrag: function(e) { + var offsetX, content; + + this._initDrag(); + + this.el.classList.remove('scroll-scrolling'); + + var scrollTop = parseFloat(this.el.scrollTop); + + this._drag = { + startY: scrollTop + }; + }, + + /** + * Process the drag event to move the item to the left or right. + */ + _handleDrag: function(e) { + var _this = this; + + window.requestAnimationFrame(function() { + var content; + + // We really aren't dragging + if(!_this._drag) { + _this._startDrag(e); + } + console.log('At scroll top', _this.el.scrollTop, e.gesture.deltaY); + + _this.el.style.webkitTransform = 'translate3d(0,' + e.gesture.deltaY + 'px, 0)'; + }); + }, + _handleEndDrag: function(e) { + var _this = this; + + window.requestAnimationFrame(function() { + + // We didn't have a drag, so just init and leave + if(!_this._drag) { + _this._initDrag(); + return; + } + + _this._initDrag(); + }); + } + }; + })(ionic); ; (function(ionic) { diff --git a/js/ext/angular/src/directive/ionicContent.js b/js/ext/angular/src/directive/ionicContent.js index cb29fb1657..b7b75ec9fc 100644 --- a/js/ext/angular/src/directive/ionicContent.js +++ b/js/ext/angular/src/directive/ionicContent.js @@ -15,6 +15,9 @@ angular.module('ionic.ui.content', []) return function($scope, $element, $attr) { var c = $element.eq(0); + if(attr.padded) { + c.addClass('padding'); + } if(attr.hasHeader) { c.addClass('has-header'); diff --git a/js/views/scrollView.js b/js/views/scrollView.js new file mode 100644 index 0000000000..c9f884bd5f --- /dev/null +++ b/js/views/scrollView.js @@ -0,0 +1,85 @@ +(function(ionic) { +'use strict'; + + ionic.views.Scroll = function(opts) { + var _this = this; + + // Extend the options with our defaults + ionic.Utils.extend(opts, { + decelerationRate: ionic.views.Scroll.prototype.DECEL_RATE_NORMAL + }); + + this.el = opts.el; + this.decelerationRate = opts.decelerationRate + + // Listen for drag and release events + window.ionic.onGesture('drag', function(e) { + _this._handleDrag(e); + }, this.el); + window.ionic.onGesture('release', function(e) { + _this._handleEndDrag(e); + }, this.el); + }; + + ionic.views.Scroll.prototype = { + DECEL_RATE_NORMAL: 0.998, + DECEL_RATE_FAST: 0.99, + + _initDrag: function() { + this._isDragging = false; + this._drag = null; + }, + + /** + * Initialize a drag by grabbing the content area to drag, and any other + * info we might need for the dragging. + */ + _startDrag: function(e) { + var offsetX, content; + + this._initDrag(); + + this.el.classList.remove('scroll-scrolling'); + + var scrollTop = parseFloat(this.el.scrollTop); + + this._drag = { + startY: scrollTop + }; + }, + + /** + * Process the drag event to move the item to the left or right. + */ + _handleDrag: function(e) { + var _this = this; + + window.requestAnimationFrame(function() { + var content; + + // We really aren't dragging + if(!_this._drag) { + _this._startDrag(e); + } + console.log('At scroll top', _this.el.scrollTop, e.gesture.deltaY); + + _this.el.style.webkitTransform = 'translate3d(0,' + e.gesture.deltaY + 'px, 0)'; + }); + }, + _handleEndDrag: function(e) { + var _this = this; + + window.requestAnimationFrame(function() { + + // We didn't have a drag, so just init and leave + if(!_this._drag) { + _this._initDrag(); + return; + } + + _this._initDrag(); + }); + } + }; + +})(ionic); diff --git a/scss/ionic/_bar.scss b/scss/ionic/_bar.scss index 5d2bb7ea12..24712677e1 100644 --- a/scss/ionic/_bar.scss +++ b/scss/ionic/_bar.scss @@ -25,6 +25,18 @@ border-top-width: 1px; } + &.bar-clear { + background: none; + color: #fff; + border: none; + .button { + color: #fff; + } + .title { + color: #fff; + } + } + &.bar-default { @include bar-style($bar-default-bg, $bar-default-border-color, $gray-dark); } diff --git a/scss/ionic/_scaffolding.scss b/scss/ionic/_scaffolding.scss index 5558965664..c489f05fb3 100644 --- a/scss/ionic/_scaffolding.scss +++ b/scss/ionic/_scaffolding.scss @@ -74,8 +74,7 @@ body, .ionic-body { .content { position: absolute; width: 100%; - top: 0; - bottom: 0; + height: 100%; overflow: auto; -webkit-overflow-scrolling: touch; } diff --git a/scss/ionic/_scroll.scss b/scss/ionic/_scroll.scss new file mode 100644 index 0000000000..3d971807e1 --- /dev/null +++ b/scss/ionic/_scroll.scss @@ -0,0 +1,8 @@ +/** + * Scroll is the scroll view component available for complex and custom + * scroll view functionality. + */ +.scroll { + position: absolute; + width: 100%; +} diff --git a/scss/ionic/ionic.scss b/scss/ionic/ionic.scss index a1bfaaf104..aadad20ef0 100644 --- a/scss/ionic/ionic.scss +++ b/scss/ionic/ionic.scss @@ -42,6 +42,7 @@ "card", "slideBox", + "scroll", "nav", diff --git a/starters/weather/index.html b/starters/weather/index.html new file mode 100644 index 0000000000..9a352f6361 --- /dev/null +++ b/starters/weather/index.html @@ -0,0 +1,112 @@ + + + + Weather + + + + + + + + + + + + + + + + + +
{{current.cover}}
+
H: {{current.high}} L: {{current.low}}
+

{{current.temp}}°

+
+ + + + +
+ + + + diff --git a/starters/weather/madison1.jpg b/starters/weather/madison1.jpg new file mode 100644 index 0000000000..9c1a0bf835 Binary files /dev/null and b/starters/weather/madison1.jpg differ diff --git a/starters/weather/madison2.jpg b/starters/weather/madison2.jpg new file mode 100644 index 0000000000..52e2c63eff Binary files /dev/null and b/starters/weather/madison2.jpg differ diff --git a/starters/weather/weather.css b/starters/weather/weather.css new file mode 100644 index 0000000000..da54b146b2 --- /dev/null +++ b/starters/weather/weather.css @@ -0,0 +1,44 @@ +body { + background: url('madison2.jpg') no-repeat transparent; + background-size: cover; +} +h1,h2,h3,h4,h5 { + color: #fff; + font-weight: 300; +} + +#header .title { + font-size: 12px; + line-height: 20px; +} +#main-content { + color: #fff; +} + +#small-weather { + height: 200px; +} +#small-weather > * { + color: #fff; +} +#small-weather .current-temp { + font-size: 100px; + font-weight: 100; + margin: 0; + padding: 0; + line-height: 80px; +} + +.weather-box { + background-color: rgba(0,0,0,0.2); + padding: 5px; + margin: 10px 0px; +} + +.weather-box .title { + color: #fff; + font-weight: normal; + margin: 0; + padding-bottom: 3px; + border-bottom: 1px solid #fff; +} diff --git a/test/scroll.html b/test/scroll.html index a29d34a7eb..8ad4eeb015 100644 --- a/test/scroll.html +++ b/test/scroll.html @@ -1,44 +1,31 @@ - iOS 7 + Scroll - +
Edit -

World Clock

+

Scroll Me

Delete
-
- -
-
+ +