fix .padding for .scroll

This commit is contained in:
Adam Bradley
2013-11-27 10:45:44 -06:00
parent e56a1a9608
commit 9b42ae65f1
3 changed files with 27 additions and 19 deletions

View File

@@ -658,16 +658,10 @@ angular.module('ionic.ui.content', [])
return function($scope, $element, $attr) {
var
c = $element.eq(0),
scroll = $element[0].querySelector('.scroll'),
clone,
sc,
sv;
if(scroll && attr.padding == "true") {
scroll.classList.add('padding');
} else if(attr.padding == "true") {
c.addClass('padding');
}
sv,
addedPadding = false;
if(attr.hasHeader == "true") {
c.addClass('has-header');
@@ -702,6 +696,10 @@ angular.module('ionic.ui.content', [])
} else {
sc = document.createElement('div');
sc.className = 'scroll';
if(attr.padding == "true") {
sc.className += ' padding';
addedPadding = true;
}
$element.append(sc);
// Otherwise, supercharge this baby!
sv = new ionic.views.Scroll({
@@ -723,6 +721,12 @@ angular.module('ionic.ui.content', [])
clone = transclude($scope.$parent);
angular.element($element[0].firstElementChild).append(clone);
}
// if padding attribute is true, then add padding if it wasn't added to the .scroll
if(attr.padding == "true" && !addedPadding) {
c.addClass('padding');
}
};
}
};

6
dist/js/ionic.js vendored
View File

@@ -3232,7 +3232,7 @@ window.ionic = {
ionic.extend(this, opts);
if(!this.itemHeight && this.listEl) {
this.itemHeight = this.listEl.children[0] && parseInt(this.listEl.children[0].style.height);
this.itemHeight = this.listEl.children[0] && parseInt(this.listEl.children[0].style.height, 10);
}
ionic.views.ListView.__super__.initialize.call(this, opts);
@@ -3294,8 +3294,8 @@ window.ionic = {
// Get the first and last elements in the list based on how many can fit
// between the pixel range of lowWater and highWater
var first = parseInt(Math.abs(highWater / itemHeight));
var last = parseInt(Math.abs(lowWater / itemHeight));
var first = parseInt(Math.abs(highWater / itemHeight), 10);
var last = parseInt(Math.abs(lowWater / itemHeight), 10);
// Get the items we need to remove
this._virtualItemsToRemove = Array.prototype.slice.call(this.listEl.children, 0, first);

View File

@@ -34,16 +34,10 @@ angular.module('ionic.ui.content', [])
return function($scope, $element, $attr) {
var
c = $element.eq(0),
scroll = $element[0].querySelector('.scroll'),
clone,
sc,
sv;
if(scroll && attr.padding == "true") {
scroll.classList.add('padding');
} else if(attr.padding == "true") {
c.addClass('padding');
}
sv,
addedPadding = false;
if(attr.hasHeader == "true") {
c.addClass('has-header');
@@ -78,6 +72,10 @@ angular.module('ionic.ui.content', [])
} else {
sc = document.createElement('div');
sc.className = 'scroll';
if(attr.padding == "true") {
sc.className += ' padding';
addedPadding = true;
}
$element.append(sc);
// Otherwise, supercharge this baby!
sv = new ionic.views.Scroll({
@@ -99,6 +97,12 @@ angular.module('ionic.ui.content', [])
clone = transclude($scope.$parent);
angular.element($element[0].firstElementChild).append(clone);
}
// if padding attribute is true, then add padding if it wasn't added to the .scroll
if(attr.padding == "true" && !addedPadding) {
c.addClass('padding');
}
};
}
};