diff --git a/dist/ionic.js b/dist/ionic.js index f136fbe948..0aa716dae8 100644 --- a/dist/ionic.js +++ b/dist/ionic.js @@ -1702,13 +1702,21 @@ ionic.views.HeaderBar = function(opts) { ionic.views.NavBar.prototype = { resizeTitle: function() { - var e, - children = this.el.children, - index = Array.prototype.indexOf.call(children, this.el); + var e; + var j; + var children = this.el.children; - for(var i = 0; i < index; i++) { + var title; + var titleWidth; + + for(var i = 0; j = children.length; i < j; i++) { e = children[i]; + if(/h\d/.test(e.nodeName.toLowerCase())) { + title = e; + } } + + titleWidth = title.offsetWidth; } }; })(window.ionic); diff --git a/js/views/headerBar.js b/js/views/headerBar.js index 36894867ac..0a8a79ab53 100644 --- a/js/views/headerBar.js +++ b/js/views/headerBar.js @@ -8,13 +8,21 @@ ionic.views.HeaderBar = function(opts) { ionic.views.NavBar.prototype = { resizeTitle: function() { - var e, - children = this.el.children, - index = Array.prototype.indexOf.call(children, this.el); + var e; + var j; + var children = this.el.children; - for(var i = 0; i < index; i++) { + var title; + var titleWidth; + + for(var i = 0; j = children.length; i < j; i++) { e = children[i]; + if(/h\d/.test(e.nodeName.toLowerCase())) { + title = e; + } } + + titleWidth = title.offsetWidth; } }; })(window.ionic); diff --git a/test/headerBarTitle.html b/test/headerBarTitle.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/scroll.html b/test/scroll.html index 995164d5a9..f6299ea8e1 100644 --- a/test/scroll.html +++ b/test/scroll.html @@ -6,37 +6,28 @@ - - + -
-
-
- Edit -

World Clock

- Delete -
-
-
-
-
-
-
- Edit -

World Clock

- Delete -
-
-
-
-
-
- +
+
+ Edit +

World Clock

+ Delete +
+
+
+
+
+
+
+ Edit +

World Clock

+ Delete +
+
+
+
+