From 35da1cb66ac8a22d4e8c6d0700e56ae31ec77117 Mon Sep 17 00:00:00 2001 From: Jordan Humphreys Date: Mon, 1 Apr 2013 14:14:58 -0700 Subject: [PATCH] Updates to RTL clearing and RTL section.js --- docs/components/section.html.erb | 24 ++++++++++++++++++++++++ js/foundation/foundation.clearing.js | 1 - js/foundation/foundation.section.js | 27 ++++++++++++++++++++------- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/docs/components/section.html.erb b/docs/components/section.html.erb index c48cfa52b..2472f3119 100644 --- a/docs/components/section.html.erb +++ b/docs/components/section.html.erb @@ -64,6 +64,30 @@ +
+

Section 3

+
+ +
+
+
+

Section 4

+
+ +
+
diff --git a/js/foundation/foundation.clearing.js b/js/foundation/foundation.clearing.js index b96d430d7..0918784e7 100644 --- a/js/foundation/foundation.clearing.js +++ b/js/foundation/foundation.clearing.js @@ -278,7 +278,6 @@ }, center : function (target) { - console.log(this.rtl) if (!this.rtl) { target.css({ marginLeft : -(this.outerWidth(target) / 2), diff --git a/js/foundation/foundation.section.js b/js/foundation/foundation.section.js index 7bffee6b9..78a0cea26 100644 --- a/js/foundation/foundation.section.js +++ b/js/foundation/foundation.section.js @@ -6,7 +6,7 @@ Foundation.libs.section = { name: 'section', - version : '4.0.9', + version : '4.1.0', settings : { deep_linking: false, @@ -16,9 +16,8 @@ init : function (scope, method, options) { var self = this; - - this.scope = scope || this.scope; - Foundation.inherit(this, 'throttle data_options'); + Foundation.inherit(this, 'throttle data_options position_right offset_right'); + console.log(this) if (typeof method != 'string') { this.set_active_from_hash(); @@ -214,7 +213,11 @@ } else { titles.each(function () { - $(this).css('left', previous_width); + if (!self.rtl) { + $(this).css('left', previous_width); + } else { + $(this).css('right', previous_width); + } previous_width += self.outerWidth($(this)); }); } @@ -232,8 +235,11 @@ section.find('section, .section').each(function () { var title = $(this).find('.title'), content = $(this).find('.content'); - - content.css({left: title.position().left - 1, top: self.outerHeight(title) - 2}); + if (!self.rtl) { + content.css({left: title.position().left - 1, top: self.outerHeight(title) - 2}); + } else { + content.css({right: self.position_right(title) + 1, top: self.outerHeight(title) - 2}); + } }); // temporary work around for Zepto outerheight calculation issues. @@ -246,6 +252,13 @@ }, + position_right : function (el) { + var section = el.closest('[data-section]'), + section_width = el.closest('[data-section]').width(), + offset = section.find('.title').length; + return (section_width - el.position().left - el.width() * (el.index() + 1) - offset); + }, + small : function (el) { var settings = $.extend({}, this.settings, this.data_options(el)); if (this.is_tabs(el)) { -- 2.47.3