bompasteque
v1.0.3
Published
el = $('[data-bompasteque]') lineUnit = $('html').css('font-size').replace('px', '') lineUnit = Number.parseFloat(lineUnit) lineMulti = $('html').css('line-height').replace('px', '') lineMulti = Number.parseFloat(lineMulti) lineMulti = lineMulti / lineU
Downloads
2
Readme
el = $('[data-bompasteque]')
lineUnit = $('html').css('font-size').replace('px', '')
lineUnit = Number.parseFloat(lineUnit)
lineMulti = $('html').css('line-height').replace('px', '')
lineMulti = Number.parseFloat(lineMulti)
lineMulti = lineMulti / lineUnit
getBaseline = () -> newLineUnit = $('html').css('font-size').replace('px', '') newLineUnit = Number.parseFloat(newLineUnit) if newLineUnit != lineUnit lineUnit = newLineUnit lineUnit $(window).on('resize', (e) -> if window.resizeEvent clearTimeout(window.resizeEvent) window.resizeEvent = setTimeout(-> getBaseline() lineHeight = lineUnit * lineMulti el.each -> $this = $(@) tHeight = $this.height() linesFor = Math.ceil(theight / lineUnit) rhythm = linesFor * lineHeight push = rhythm - tHeight $this.css('margin-bottom', push + 'px') return return , 600) return ).trigger('resize')