mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Support multiple children inside .layout-cell.width-fix
This commit is contained in:
parent
2a26aa6889
commit
e6a17f8f2b
@ -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')
|
||||
}
|
||||
})
|
||||
|
@ -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})
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user