foundation
Advanced tools
Comparing version 4.0.0-wip to 4.1.1-s1
@@ -0,1 +1,11 @@ | ||
### 4.1.1- April 2, 2013 | ||
* Changed all references to the variable `$default-opposite` to `$opposite-direction` | ||
* Added `dir` attribute to `html` tag | ||
* Added direction variables to `foundation.dropdown.js`, `foundation.clearing.js`, `foundation.joyride.js`, `foundation.orbit.js`, `foundation.section.js`, `foundation.topbar.js` and `foundation.tooltips.js`. | ||
* Updated customizer with text direction setting | ||
* Added right-to-left text direction documentation | ||
You can compare the commits [here](https://github.com/zurb/foundation/compare/v4.0.9...v4.1.1). | ||
### 4.0.9- March 19, 2013 | ||
@@ -2,0 +12,0 @@ * Added `auto` option to `Foundation.section.js. |
@@ -9,3 +9,3 @@ /*jslint unparam: true, browser: true, indent: 2 */ | ||
version : '4.0.0', | ||
version : '4.1.2', | ||
@@ -16,4 +16,4 @@ settings : { | ||
'<div class="visible-img" style="display: none"><img src="//:0">' + | ||
'<p class="clearing-caption"></p><a href="#" class="clearing-main-left"><span></span></a>' + | ||
'<a href="#" class="clearing-main-right"><span></span></a></div>' | ||
'<p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a>' + | ||
'<a href="#" class="clearing-main-next"><span></span></a></div>' | ||
}, | ||
@@ -31,4 +31,4 @@ | ||
init : function (scope, method, options) { | ||
this.scope = this.scope || scope; | ||
Foundation.inherit(this, 'set_data get_data remove_data throttle'); | ||
var self = this; | ||
Foundation.inherit(this, 'set_data get_data remove_data throttle data_options'); | ||
@@ -41,11 +41,11 @@ if (typeof method === 'object') { | ||
$(this.scope).find('ul[data-clearing]').each(function () { | ||
var self = Foundation.libs.clearing, | ||
$el = $(this), | ||
var $el = $(this), | ||
options = options || {}, | ||
lis = $el.find('li'), | ||
settings = self.get_data($el); | ||
if (!settings) { | ||
if (!settings && lis.length > 0) { | ||
options.$parent = $el.parent(); | ||
self.set_data($el, $.extend(true, self.settings, options)); | ||
self.set_data($el, $.extend({}, self.settings, options, self.data_options($el))); | ||
@@ -87,5 +87,5 @@ self.assemble($el.find('li')); | ||
.on('click.fndtn.clearing', '.clearing-main-right', | ||
.on('click.fndtn.clearing', '.clearing-main-next', | ||
function (e) { this.nav(e, 'next') }.bind(this)) | ||
.on('click.fndtn.clearing', '.clearing-main-left', | ||
.on('click.fndtn.clearing', '.clearing-main-prev', | ||
function (e) { this.nav(e, 'prev') }.bind(this)) | ||
@@ -152,3 +152,6 @@ .on('click.fndtn.clearing', this.settings.close_selectors, | ||
assemble : function ($li) { | ||
var $el = $li.parent(), | ||
var $el = $li.parent(); | ||
$el.after('<div id="foundationClearingHolder"></div>'); | ||
var holder = $('#foundationClearingHolder'), | ||
settings = this.get_data($el), | ||
@@ -163,3 +166,3 @@ grid = $el.detach(), | ||
return settings.$parent.append(wrapper); | ||
return holder.after(wrapper).remove(); | ||
}, | ||
@@ -177,5 +180,8 @@ | ||
// set the image to the selected thumbnail | ||
image.attr('src', this.load($image)); | ||
image | ||
.attr('src', this.load($image)) | ||
.css('visibility', 'hidden'); | ||
this.loaded(image, function () { | ||
image.css('visibility', 'visible'); | ||
// toggle the gallery | ||
@@ -268,19 +274,19 @@ root.addClass('clearing-blackout'); | ||
if (target.next().length) { | ||
if (target.next().length > 0) { | ||
visible_image | ||
.find('.clearing-main-right') | ||
.find('.clearing-main-next') | ||
.removeClass('disabled'); | ||
} else { | ||
visible_image | ||
.find('.clearing-main-right') | ||
.find('.clearing-main-next') | ||
.addClass('disabled'); | ||
} | ||
if (target.prev().length) { | ||
if (target.prev().length > 0) { | ||
visible_image | ||
.find('.clearing-main-left') | ||
.find('.clearing-main-prev') | ||
.removeClass('disabled'); | ||
} else { | ||
visible_image | ||
.find('.clearing-main-left') | ||
.find('.clearing-main-prev') | ||
.addClass('disabled'); | ||
@@ -291,6 +297,13 @@ } | ||
center : function (target) { | ||
target.css({ | ||
marginLeft : -(this.outerWidth(target) / 2), | ||
marginTop : -(this.outerHeight(target) / 2) | ||
}); | ||
if (!this.rtl) { | ||
target.css({ | ||
marginLeft : -(this.outerWidth(target) / 2), | ||
marginTop : -(this.outerHeight(target) / 2) | ||
}); | ||
} else { | ||
target.css({ | ||
marginRight : -(this.outerWidth(target) / 2), | ||
marginTop : -(this.outerHeight(target) / 2) | ||
}); | ||
} | ||
return this; | ||
@@ -341,3 +354,3 @@ }, | ||
if (this.complete || this.readyState === 4) { | ||
if (image[0].complete || image[0].readyState === 4) { | ||
loaded(); | ||
@@ -488,2 +501,6 @@ } else { | ||
this.settings.init = false; | ||
}, | ||
reflow : function () { | ||
this.init(); | ||
} | ||
@@ -490,0 +507,0 @@ }; |
@@ -9,3 +9,3 @@ /*jslint unparam: true, browser: true, indent: 2 */ | ||
version : '4.0.9', | ||
version : '4.1.0', | ||
@@ -18,3 +18,3 @@ settings : { | ||
this.scope = scope || this.scope; | ||
Foundation.inherit(this, 'throttle'); | ||
Foundation.inherit(this, 'throttle scrollLeft'); | ||
@@ -42,12 +42,19 @@ if (typeof method === 'object') { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
self.toggle($(this)); | ||
}); | ||
$('*, html, body').on('click.fndtn.dropdown', function (e) { | ||
if (!$(e.target).data('dropdown')) { | ||
$('[data-dropdown-content]') | ||
.css('left', '-99999px') | ||
.removeClass(self.settings.activeClass); | ||
$('body').on('click.fndtn.dropdown', function (e) { | ||
var parent = $(e.target).closest('[data-dropdown-content]'); | ||
if ($(e.target).data('dropdown')) { | ||
return; | ||
} | ||
if (parent.length > 0 && ($(e.target).is('[data-dropdown-content]') || $.contains(parent.first()[0], e.target))) { | ||
e.stopPropagation(); | ||
return; | ||
} | ||
$('[data-dropdown-content]') | ||
.css(Foundation.rtl ? 'right':'left', '-99999px') | ||
.removeClass(self.settings.activeClass); | ||
}); | ||
@@ -65,7 +72,10 @@ | ||
$('[data-dropdown-content]').not(dropdown).css('left', '-99999px').removeClass(this.settings.activeClass); | ||
$('[data-dropdown-content]') | ||
.not(dropdown) | ||
.css(Foundation.rtl ? 'right':'left', '-99999px') | ||
.removeClass(this.settings.activeClass); | ||
if (dropdown.hasClass(this.settings.activeClass)) { | ||
dropdown | ||
.css('left', '-99999px') | ||
.css(Foundation.rtl ? 'right':'left', '-99999px') | ||
.removeClass(this.settings.activeClass); | ||
@@ -90,4 +100,4 @@ } else { | ||
var position = target.position(); | ||
position.top += target.offsetParent().scrollTop(); | ||
position.left += target.offsetParent().scrollLeft(); | ||
position.top += target.offsetParent().offset().top; | ||
position.left += target.offsetParent().offset().left; | ||
@@ -103,3 +113,3 @@ if (this.small()) { | ||
} else { | ||
if ($(window).width() > this.outerWidth(dropdown) + target.offset().left) { | ||
if (!Foundation.rtl && $(window).width() > this.outerWidth(dropdown) + target.offset().left) { | ||
var left = position.left; | ||
@@ -112,2 +122,3 @@ } else { | ||
} | ||
dropdown.attr('style', '').css({ | ||
@@ -114,0 +125,0 @@ position : 'absolute', |
@@ -48,2 +48,12 @@ /*jslint unparam: true, browser: true, indent: 2 */ | ||
$(this.scope) | ||
.on('click.fndtn.forms', 'form.custom span.custom.checkbox', function (e) { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
self.toggle_checkbox($(this)); | ||
}) | ||
.on('click.fndtn.forms', 'form.custom span.custom.radio', function (e) { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
self.toggle_radio($(this)); | ||
}) | ||
.on('change.fndtn.forms', 'form.custom select:not([data-customforms="disabled"])', function (e) { | ||
@@ -60,5 +70,5 @@ self.refresh_custom_select($(this)); | ||
$customCheckbox = $(this).find('span.custom.checkbox'); | ||
//the checkbox might be outside after the label | ||
//the checkbox might be outside after the label or inside of another element | ||
if ($customCheckbox.length == 0) { | ||
$customCheckbox = $(this).siblings('span.custom.checkbox').first(); | ||
$customCheckbox = $associatedElement.add(this).siblings('span.custom.checkbox').first(); | ||
} | ||
@@ -69,5 +79,5 @@ self.toggle_checkbox($customCheckbox); | ||
$customRadio = $(this).find('span.custom.radio'); | ||
//the radio might be outside after the label | ||
//the radio might be outside after the label or inside of another element | ||
if ($customRadio.length == 0) { | ||
$customRadio = $(this).siblings('span.custom.radio').first(); | ||
$customRadio = $associatedElement.add(this).siblings('span.custom.radio').first(); | ||
} | ||
@@ -140,2 +150,33 @@ self.toggle_radio($customRadio); | ||
$(window).on('keydown', function (e) { | ||
var focus = document.activeElement, | ||
dropdown = $('.custom.dropdown.open'); | ||
if (dropdown.length > 0) { | ||
e.preventDefault(); | ||
if (e.which === 13) { | ||
dropdown.find('li.selected').trigger('click'); | ||
} | ||
if (e.which === 38) { | ||
var current = dropdown.find('li.selected'), | ||
prev = current.prev(':not(.disabled)'); | ||
if (prev.length > 0) { | ||
current.removeClass('selected'); | ||
prev.addClass('selected'); | ||
} | ||
} else if (e.which === 40) { | ||
var current = dropdown.find('li.selected'), | ||
next = current.next(':not(.disabled)'); | ||
if (next.length > 0) { | ||
current.removeClass('selected'); | ||
next.addClass('selected'); | ||
} | ||
} | ||
} | ||
}); | ||
this.settings.init = true; | ||
@@ -142,0 +183,0 @@ }, |
@@ -9,8 +9,10 @@ /*jslint unparam: true, browser: true, indent: 2 */ | ||
version : '4.0.0', | ||
version : '4.1.2', | ||
defaults : { | ||
expose : false, // turn on or off the expose feature | ||
modal : false, // Whether to cover page with modal during the tour | ||
tipLocation : 'bottom', // 'top' or 'bottom' in relation to parent | ||
nubPosition : 'auto', // override on a per tooltip bases | ||
scrollSpeed : 300, // Page scrolling speed in milliseconds | ||
scrollSpeed : 300, // Page scrolling speed in milliseconds, 0 = no scroll animation | ||
timer : 0, // 0 = no timer , all other numbers = timer in milliseconds | ||
@@ -22,2 +24,3 @@ startTimerOnClick : true, // true or false - true requires clicking the first button start the timer | ||
pauseAfter : [], // array of indexes where to pause the tour after | ||
exposed : [], // array of expose elements | ||
tipAnimationFadeSpeed: 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition | ||
@@ -31,2 +34,5 @@ cookieMonster : false, // true or false to control whether cookies are used | ||
postStepCallback : function (){}, // A method to call after each step | ||
preStepCallback : function (){}, // A method to call before each step | ||
preRideCallback : function (){}, // A method to call before the tour starts (passed index, tip, and cloned exposed element) | ||
postExposeCallback : function (){}, // A method to call after an element has been exposed | ||
template : { // HTML segments for tip layout | ||
@@ -37,3 +43,6 @@ link : '<a href="#close" class="joyride-close-tip">×</a>', | ||
wrapper : '<div class="joyride-content-wrapper"></div>', | ||
button : '<a href="#" class="small button joyride-next-tip"></a>' | ||
button : '<a href="#" class="small button joyride-next-tip"></a>', | ||
modal : '<div class="joyride-modal-bg"></div>', | ||
expose : '<div class="joyride-expose-wrapper"></div>', | ||
exposeCover: '<div class="joyride-expose-cover"></div>' | ||
} | ||
@@ -91,6 +100,16 @@ }, | ||
if ($('[data-joyride]').length > 0 && self.settings.$next_tip) { | ||
if (self.settings.exposed.length > 0) { | ||
var $els = $(self.settings.exposed); | ||
$els.each(function () { | ||
var $this = $(this); | ||
self.un_expose($this); | ||
self.expose($this); | ||
}); | ||
} | ||
if (self.is_phone()) { | ||
self.pos_phone(); | ||
} else { | ||
self.pos_default(); | ||
self.pos_default(false, true); | ||
} | ||
@@ -113,2 +132,3 @@ } | ||
this.settings.$content_el = $this; | ||
this.settings.$body = $(this.settings.tipContainer); | ||
this.settings.body_offset = $(this.settings.tipContainer).position(); | ||
@@ -228,3 +248,15 @@ this.settings.$tip_content = this.settings.$content_el.find('> li'); | ||
if (this.settings.$li.length && this.settings.$target.length > 0) { | ||
if (init) { //run when we first start | ||
this.settings.preRideCallback(this.settings.$li.index(), this.settings.$next_tip); | ||
if (this.settings.modal) { | ||
this.show_modal(); | ||
} | ||
} | ||
this.settings.preStepCallback(this.settings.$li.index(), this.settings.$next_tip); | ||
if (this.settings.modal && this.settings.expose) { | ||
this.expose(); | ||
} | ||
this.settings.tipSettings = $.extend(this.settings, this.data_options(this.settings.$li)); | ||
@@ -253,3 +285,3 @@ | ||
if (thsi.settings.timer > 0) { | ||
if (this.settings.timer > 0) { | ||
@@ -321,6 +353,12 @@ this.settings.$next_tip.show(); | ||
hide : function () { | ||
if (this.settings.modal && this.settings.expose) { | ||
this.un_expose(); | ||
} | ||
if (!this.settings.modal) { | ||
$('.joyride-modal-bg').hide(); | ||
} | ||
this.settings.$current_tip.hide(); | ||
this.settings.postStepCallback(this.settings.$li.index(), | ||
this.settings.$current_tip); | ||
$('.joyride-modal-bg').hide(); | ||
this.settings.$current_tip.hide(); | ||
}, | ||
@@ -386,6 +424,7 @@ | ||
pos_default : function (init) { | ||
pos_default : function (init, resizing) { | ||
var half_fold = Math.ceil($(window).height() / 2), | ||
tip_position = this.settings.$next_tip.offset(), | ||
$nub = this.settings.$next_tip.find('.joyride-nub'), | ||
nub_width = Math.ceil(this.outerWidth($nub) / 2), | ||
nub_height = Math.ceil(this.outerHeight($nub) / 2), | ||
@@ -400,8 +439,16 @@ toggle = init || false; | ||
if (typeof resizing === 'undefined') { | ||
resizing = false; | ||
} | ||
if (!/body/i.test(this.settings.$target.selector)) { | ||
if (this.bottom()) { | ||
var leftOffset = this.settings.$target.offset().left; | ||
if (Foundation.rtl) { | ||
leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset; | ||
} | ||
this.settings.$next_tip.css({ | ||
top: (this.settings.$target.offset().top + nub_height + this.outerHeight(this.settings.$target)), | ||
left: this.settings.$target.offset().left}); | ||
left: leftOffset}); | ||
@@ -411,6 +458,9 @@ this.nub_position($nub, this.settings.tipSettings.nubPosition, 'top'); | ||
} else if (this.top()) { | ||
var leftOffset = this.settings.$target.offset().left; | ||
if (Foundation.rtl) { | ||
leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset; | ||
} | ||
this.settings.$next_tip.css({ | ||
top: (this.settings.$target.offset().top - this.outerHeight(this.settings.$next_tip) - nub_height), | ||
left: this.settings.$target.offset().left}); | ||
left: leftOffset}); | ||
@@ -423,3 +473,3 @@ this.nub_position($nub, this.settings.tipSettings.nubPosition, 'bottom'); | ||
top: this.settings.$target.offset().top, | ||
left: (this.outerWidth(this.settings.$target) + this.settings.$target.offset().left)}); | ||
left: (this.outerWidth(this.settings.$target) + this.settings.$target.offset().left + nub_width)}); | ||
@@ -432,3 +482,3 @@ this.nub_position($nub, this.settings.tipSettings.nubPosition, 'left'); | ||
top: this.settings.$target.offset().top, | ||
left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) - nub_height)}); | ||
left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) - nub_width)}); | ||
@@ -450,3 +500,3 @@ this.nub_position($nub, this.settings.tipSettings.nubPosition, 'right'); | ||
this.pos_default(true); | ||
this.pos_default(); | ||
@@ -513,5 +563,10 @@ } | ||
$nub.hide(); | ||
this.show_modal(); | ||
}, | ||
show_modal : function () { | ||
if (!this.settings.$next_tip.data('closed')) { | ||
if ($('.joyride-modal-bg').length < 1) { | ||
$('body').append('<div class="joyride-modal-bg">').show(); | ||
$('body').append(this.settings.template.modal).show(); | ||
} | ||
@@ -527,2 +582,147 @@ | ||
expose : function () { | ||
var expose, | ||
exposeCover, | ||
el, | ||
origCSS, | ||
randId = 'expose-'+Math.floor(Math.random()*10000); | ||
if (arguments.length > 0 && arguments[0] instanceof $) { | ||
el = arguments[0]; | ||
} else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){ | ||
el = this.settings.$target; | ||
} else { | ||
return false; | ||
} | ||
if(el.length < 1){ | ||
if(window.console){ | ||
console.error('element not valid', el); | ||
} | ||
return false; | ||
} | ||
expose = $(this.settings.template.expose); | ||
this.settings.$body.append(expose); | ||
expose.css({ | ||
top: el.offset().top, | ||
left: el.offset().left, | ||
width: this.outerWidth(el, true), | ||
height: this.outerHeight(el, true) | ||
}); | ||
exposeCover = $(this.settings.template.exposeCover); | ||
origCSS = { | ||
zIndex: el.css('z-index'), | ||
position: el.css('position') | ||
}; | ||
el.css('z-index',expose.css('z-index')*1+1); | ||
if (origCSS.position == 'static') { | ||
el.css('position','relative'); | ||
} | ||
el.data('expose-css',origCSS); | ||
exposeCover.css({ | ||
top: el.offset().top, | ||
left: el.offset().left, | ||
width: this.outerWidth(el, true), | ||
height: this.outerHeight(el, true) | ||
}); | ||
this.settings.$body.append(exposeCover); | ||
expose.addClass(randId); | ||
exposeCover.addClass(randId); | ||
el.data('expose', randId); | ||
this.settings.postExposeCallback(this.settings.$li.index(), this.settings.$next_tip, el); | ||
this.add_exposed(el); | ||
}, | ||
un_expose : function () { | ||
var exposeId, | ||
el, | ||
expose , | ||
origCSS, | ||
clearAll = false; | ||
if (arguments.length > 0 && arguments[0] instanceof $) { | ||
el = arguments[0]; | ||
} else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){ | ||
el = this.settings.$target; | ||
} else { | ||
return false; | ||
} | ||
if(el.length < 1){ | ||
if (window.console) { | ||
console.error('element not valid', el); | ||
} | ||
return false; | ||
} | ||
exposeId = el.data('expose'); | ||
expose = $('.' + exposeId); | ||
if (arguments.length > 1) { | ||
clearAll = arguments[1]; | ||
} | ||
if (clearAll === true) { | ||
$('.joyride-expose-wrapper,.joyride-expose-cover').remove(); | ||
} else { | ||
expose.remove(); | ||
} | ||
origCSS = el.data('expose-css'); | ||
if (origCSS.zIndex == 'auto') { | ||
el.css('z-index', ''); | ||
} else { | ||
el.css('z-index', origCSS.zIndex); | ||
} | ||
if (origCSS.position != el.css('position')) { | ||
if(origCSS.position == 'static') {// this is default, no need to set it. | ||
el.css('position', ''); | ||
} else { | ||
el.css('position', origCSS.position); | ||
} | ||
} | ||
el.removeData('expose'); | ||
el.removeData('expose-z-index'); | ||
this.remove_exposed(el); | ||
}, | ||
add_exposed: function(el){ | ||
this.settings.exposed = this.settings.exposed || []; | ||
if (el instanceof $ || typeof el === 'object') { | ||
this.settings.exposed.push(el[0]); | ||
} else if (typeof el == 'string') { | ||
this.settings.exposed.push(el); | ||
} | ||
}, | ||
remove_exposed: function(el){ | ||
var search, count; | ||
if (el instanceof $) { | ||
search = el[0] | ||
} else if (typeof el == 'string'){ | ||
search = el; | ||
} | ||
this.settings.exposed = this.settings.exposed || []; | ||
count = this.settings.exposed.length; | ||
for (var i=0; i < count; i++) { | ||
if (this.settings.exposed[i] == search) { | ||
this.settings.exposed.splice(i, 1); | ||
return; | ||
} | ||
} | ||
}, | ||
center : function () { | ||
@@ -557,10 +757,27 @@ var $w = $(window); | ||
var w = $(window), | ||
window_half = w.height() / 2, | ||
//using this to calculate since scroll may not have finished yet. | ||
tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()), | ||
right = w.width() + this.scrollLeft(w), | ||
bottom = w.width() + w.scrollTop(); | ||
offsetBottom = w.height() + tipOffset, | ||
bottom = w.height() + w.scrollTop(), | ||
top = w.scrollTop(); | ||
if (tipOffset < top) { | ||
if (tipOffset < 0) { | ||
top = 0; | ||
} else { | ||
top = tipOffset; | ||
} | ||
} | ||
if (offsetBottom > bottom) { | ||
bottom = offsetBottom; | ||
} | ||
return [ | ||
el.offset().top <= w.scrollTop(), | ||
right <= el.offset().left + this.outerWidth(el), | ||
bottom <= el.offset().top + this.outerHeight(el), | ||
this.scrollLeft(w) >= el.offset().left | ||
el.offset().top < top, | ||
right < el.offset().left + el.outerWidth(), | ||
bottom < el.offset().top + el.outerHeight(), | ||
this.scrollLeft(w) > el.offset().left | ||
]; | ||
@@ -608,2 +825,6 @@ }, | ||
if (this.settings.modal && this.settings.expose) { | ||
this.un_expose(); | ||
} | ||
this.settings.$next_tip.data('closed', true); | ||
@@ -610,0 +831,0 @@ |
@@ -101,3 +101,3 @@ /* | ||
version : '4.0.8', | ||
version : '4.1.0', | ||
@@ -117,2 +117,6 @@ // global Foundation cache object | ||
// check RTL | ||
this.rtl = /rtl/i.test($('html').attr('dir')); | ||
// set foundation global scope | ||
@@ -146,5 +150,5 @@ this.scope = scope || this.scope; | ||
response_obj : function (response_arr, args) { | ||
for (var callback in args) { | ||
if (typeof args[callback] === 'function') { | ||
return args[callback]({ | ||
for (var i = 0, len = args.length; i < len; i++) { | ||
if (typeof args[i] === 'function') { | ||
return args[i]({ | ||
errors: response_arr.filter(function (s) { | ||
@@ -183,2 +187,4 @@ if (typeof s === 'string') return s; | ||
this.fix_outer(lib); | ||
lib.scope = this.scope; | ||
lib.rtl = this.rtl; | ||
}, | ||
@@ -185,0 +191,0 @@ |
@@ -9,3 +9,3 @@ ;(function ($, window, document, undefined) { | ||
version: '4.0.7', | ||
version: '4.1.0', | ||
@@ -309,3 +309,4 @@ settings: { | ||
$active_slide = $slides_container.find('.' + self.settings.active_slide_class), | ||
active_index = $active_slide.index(); | ||
active_index = $active_slide.index(), | ||
margin_position = Foundation.rtl ? 'marginRight' : 'marginLeft'; | ||
@@ -331,7 +332,7 @@ if ($container.hasClass(self.settings.orbit_transition_class)) { | ||
if (active_index === ($slides.length - 1) && index_or_direction === 'next') { | ||
$slides_container.css('marginLeft', '0%'); | ||
$slides_container.css(margin_position, '0%'); | ||
active_index = 1; | ||
} | ||
else if (active_index === 0 && index_or_direction === 'prev') { | ||
$slides_container.css('marginLeft', '-' + ($slides.length - 1) * 100 + '%'); | ||
$slides_container.css(margin_position, '-' + ($slides.length - 1) * 100 + '%'); | ||
active_index = $slides.length - 2; | ||
@@ -353,3 +354,3 @@ } | ||
$slides_container.trigger('orbit:before-slide-change'); | ||
if ($slides_container.css('marginLeft') === new_margin_left) { | ||
if ($slides_container.css(margin_position) === new_margin_left) { | ||
$container.removeClass(self.settings.orbit_transition_class); | ||
@@ -359,5 +360,6 @@ $slides_container.trigger('orbit:after-slide-change', [{slide_number: active_index, total_slides: $slides_container.children().length - 2}]); | ||
} else { | ||
$slides_container.animate({ | ||
'marginLeft' : new_margin_left | ||
}, self.settings.animation_speed, 'linear', function() { | ||
var properties = {}; | ||
properties[margin_position] = new_margin_left; | ||
$slides_container.animate(properties, self.settings.animation_speed, 'linear', function() { | ||
$container.removeClass(self.settings.orbit_transition_class); | ||
@@ -364,0 +366,0 @@ $slides_container.trigger('orbit:after-slide-change', [{slide_number: active_index, total_slides: $slides_container.children().length - 2}]); |
@@ -135,3 +135,3 @@ /*jslint unparam: true, browser: true, indent: 2 */ | ||
this.settings.bg = $('<div />', {'class': this.settings.bgClass}) | ||
.insertAfter(modal); | ||
.appendTo('body'); | ||
} | ||
@@ -138,0 +138,0 @@ |
@@ -9,3 +9,3 @@ /*jslint unparam: true, browser: true, indent: 2 */ | ||
version : '4.0.9', | ||
version : '4.1.1', | ||
@@ -20,6 +20,4 @@ settings : { | ||
var self = this; | ||
Foundation.inherit(this, 'throttle data_options position_right offset_right'); | ||
this.scope = scope || this.scope; | ||
Foundation.inherit(this, 'throttle data_options'); | ||
if (typeof method != 'string') { | ||
@@ -146,4 +144,7 @@ this.set_active_from_hash(); | ||
var first = $this.find('section, .section').first(); | ||
first.addClass('active'); | ||
if (settings.one_up) { | ||
first.addClass('active'); | ||
} | ||
if (self.small($this)) { | ||
@@ -220,3 +221,7 @@ first.attr('style', ''); | ||
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)); | ||
@@ -239,4 +244,7 @@ }); | ||
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}); | ||
} | ||
}); | ||
@@ -254,2 +262,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); | ||
}, | ||
reflow : function () { | ||
$('[data-section]').trigger('resize'); | ||
}, | ||
small : function (el) { | ||
@@ -256,0 +275,0 @@ var settings = $.extend({}, this.settings, this.data_options(el)); |
@@ -9,3 +9,3 @@ /*jslint unparam: true, browser: true, indent: 2 */ | ||
version : '4.0.2', | ||
version : '4.1.0', | ||
@@ -140,6 +140,10 @@ settings : { | ||
} else { | ||
objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', target.offset().left, width); | ||
var left = target.offset().left; | ||
if (Foundation.rtl) { | ||
left = target.offset().left + target.offset().width - this.outerWidth(tip); | ||
} | ||
objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', left, width); | ||
tip.removeClass('tip-override'); | ||
if (classes && classes.indexOf('tip-top') > -1) { | ||
objPos(tip, (target.offset().top - this.outerHeight(tip)), 'auto', 'auto', target.offset().left, width) | ||
objPos(tip, (target.offset().top - this.outerHeight(tip)), 'auto', 'auto', left, width) | ||
.removeClass('tip-override'); | ||
@@ -146,0 +150,0 @@ } else if (classes && classes.indexOf('tip-left') > -1) { |
@@ -9,3 +9,3 @@ /*jslint unparam: true, browser: true, indent: 2 */ | ||
version : '4.0.0', | ||
version : '4.1.2', | ||
@@ -20,5 +20,4 @@ settings : { | ||
init : function (scope, method, options) { | ||
init : function (method, options) { | ||
var self = this; | ||
this.scope = scope || this.scope; | ||
@@ -82,17 +81,23 @@ if (typeof method === 'object') { | ||
if (!topbar.hasClass('expanded')) { | ||
section.css({left: '0%'}); | ||
section.find('>.name').css({left: '100%'}); | ||
if (!self.rtl) { | ||
section.css({left: '0%'}); | ||
section.find('>.name').css({left: '100%'}); | ||
} else { | ||
section.css({right: '0%'}); | ||
section.find('>.name').css({right: '100%'}); | ||
} | ||
section.find('li.moved').removeClass('moved'); | ||
topbar.data('index', 0); | ||
} | ||
if (topbar.parent().hasClass('fixed')) { | ||
if (topbar.hasClass('fixed')) { | ||
topbar.parent().addClass('fixed'); | ||
topbar.removeClass('fixed'); | ||
$('body').css('padding-top',offst); | ||
} | ||
} else if (topbar.parent().hasClass('fixed')) { | ||
topbar.parent().removeClass('fixed'); | ||
topbar.addClass('fixed'); | ||
$('body').css('padding-top','0'); | ||
window.scrollTo(0,0); | ||
} else if (topbar.hasClass('fixed expanded')) { | ||
topbar.parent().addClass('fixed'); | ||
$('body').css('padding-top',offst); | ||
} | ||
}) | ||
@@ -115,4 +120,9 @@ | ||
$selectedLi.addClass('moved'); | ||
section.css({left: -(100 * topbar.data('index')) + '%'}); | ||
section.find('>.name').css({left: 100 * topbar.data('index') + '%'}); | ||
if (!self.rtl) { | ||
section.css({left: -(100 * topbar.data('index')) + '%'}); | ||
section.find('>.name').css({left: 100 * topbar.data('index') + '%'}); | ||
} else { | ||
section.css({right: -(100 * topbar.data('index')) + '%'}); | ||
section.find('>.name').css({right: 100 * topbar.data('index') + '%'}); | ||
} | ||
@@ -124,7 +134,9 @@ $this.siblings('ul') | ||
} | ||
}); | ||
}); | ||
$(window).on('resize.fndtn.topbar', function () { | ||
if (!this.breakpoint()) { | ||
$('.top-bar').css('min-height', ''); | ||
if (!self.breakpoint()) { | ||
$('.top-bar') | ||
.css('min-height', '') | ||
.removeClass('expanded'); | ||
} | ||
@@ -144,4 +156,9 @@ }.bind(this)); | ||
topbar.data('index', topbar.data('index') - 1); | ||
section.css({left: -(100 * topbar.data('index')) + '%'}); | ||
section.find('>.name').css({'left': 100 * topbar.data('index') + '%'}); | ||
if (!self.rtl) { | ||
section.css({left: -(100 * topbar.data('index')) + '%'}); | ||
section.find('>.name').css({left: 100 * topbar.data('index') + '%'}); | ||
} else { | ||
section.css({right: -(100 * topbar.data('index')) + '%'}); | ||
section.find('>.name').css({right: 100 * topbar.data('index') + '%'}); | ||
} | ||
@@ -148,0 +165,0 @@ if (topbar.data('index') === 0) { |
{ | ||
"name": "foundation", | ||
"version": "4.0.0-wip", | ||
"version": "4.1.1-s1", | ||
"main": "stylus/foundation", | ||
@@ -10,2 +10,8 @@ "devDependencies": { | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/zurb/foundation/blob/master/LICENSE" | ||
} | ||
], | ||
"dependencies": { | ||
@@ -12,0 +18,0 @@ "stylus": "~0.32.1", |
Welcome to Foundation | ||
===================== | ||
# This is the [Stylus](https://github.com/learnboost/stylus) port of the Zurb Foundation framework | ||
Foundation is the most advanced responsive front-end framework in the world. You can quickly prototype and build sites or apps that work on any kind of device with Foundation, which includes layout constructs (like a fully responsive grid), elements and best practices. | ||
@@ -5,0 +7,0 @@ |
@@ -0,6 +1,27 @@ | ||
'use strict'; | ||
var version = require('../package.json').version; | ||
var libPath = __dirname; | ||
var dependencies = [require('stylus-type-utils')]; | ||
/** | ||
* Return the plugin callback for stylus. | ||
* | ||
* @return {Function} | ||
* @api public | ||
*/ | ||
exports = module.exports = function plugin() { | ||
return function(stylus){ | ||
stylus.include(libPath); | ||
dependencies.forEach(function(dep) { | ||
stylus.use(dep()); | ||
}); | ||
}; | ||
}; | ||
/** | ||
* Library version. | ||
*/ | ||
exports.version = require('../package.json').version; | ||
exports.version = version; | ||
@@ -10,19 +31,9 @@ /** | ||
*/ | ||
exports.path = libPath; | ||
exports.path = __dirname; | ||
/** | ||
* Return the plugin callback for stylus. | ||
* | ||
* @return {Function} | ||
* @api public | ||
* Dependent modules | ||
* | ||
* @type {Array} | ||
*/ | ||
function plugin() { | ||
return function(style){ | ||
style.include(__dirname); | ||
style.use(require('stylus-type-utils')()); | ||
}; | ||
} | ||
exports = module.exports = plugin; | ||
exports.dependencies = dependencies; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2108222
211
15442
126