Support multiple children inside .layout-cell.width-fix

This commit is contained in:
Samuel Georges 2015-07-29 19:15:42 +10:00
parent 2a26aa6889
commit e6a17f8f2b
2 changed files with 22 additions and 11 deletions

View File

@ -13,16 +13,26 @@
}
OctoberLayout.prototype.updateLayout = function(title) {
var $children, $el, fixedWidth, margin
$('.layout-cell.width-fix').each(function(){
var $el = $(this).children();
if ($el.length > 0) {
var margin = $el.data('oc.layoutMargin');
$children = $(this).children()
if ($children.length > 0) {
fixedWidth = 0
$children.each(function() {
$el = $(this)
margin = $el.data('oc.layoutMargin')
if (margin === undefined) {
margin = parseInt($el.css('marginRight')) + parseInt($el.css('marginLeft'))
$el.data('oc.layoutMargin', margin)
}
fixedWidth += $el.get(0).offsetWidth + margin
})
$(this).width($el.get(0).offsetWidth + margin)
$(this).width(fixedWidth)
$(this).trigger('oc.widthFixed')
}
})

View File

@ -25,8 +25,9 @@
$('.layout-cell.width-fix', navbar).one('oc.widthFixed', function(){
var dragScroll = $('[data-control=toolbar]', navbar).data('oc.dragScroll')
if (dragScroll)
if (dragScroll) {
dragScroll.goToElement($('ul.nav > li.active', navbar), undefined, {'duration': 0})
}
})
})
})