scroll fix: move down scrollbar with scrollHeader
This commit is contained in:
parent
702a8005d4
commit
6d7d4c4e17
2 changed files with 21 additions and 10 deletions
|
@ -258,23 +258,34 @@ class App.TicketZoom extends App.Controller
|
||||||
positionPageHeaderStop: =>
|
positionPageHeaderStop: =>
|
||||||
@main.unbind('scroll', @positionPageHeaderUpdate)
|
@main.unbind('scroll', @positionPageHeaderUpdate)
|
||||||
|
|
||||||
|
@scrollHeaderPos: undefined
|
||||||
|
|
||||||
positionPageHeaderUpdate: =>
|
positionPageHeaderUpdate: =>
|
||||||
headerHeight = @scrollPageHeader.outerHeight()
|
headerHeight = @scrollPageHeader.outerHeight()
|
||||||
mainScrollHeigth = @main.prop('scrollHeight')
|
mainScrollHeigth = @main.prop('scrollHeight')
|
||||||
mainHeigth = @main.height()
|
mainHeigth = @main.height()
|
||||||
|
|
||||||
# if page header is possible to use, show page header
|
|
||||||
top = 0
|
|
||||||
if mainScrollHeigth > mainHeigth + headerHeight
|
|
||||||
scroll = @main.scrollTop()
|
scroll = @main.scrollTop()
|
||||||
if scroll <= headerHeight
|
|
||||||
top = (scroll - headerHeight)
|
|
||||||
|
|
||||||
# if page header is not possible to use - mainScrollHeigth to low - hide page header
|
# if page header is not possible to use - mainScrollHeigth to low - hide page header
|
||||||
else
|
if not mainScrollHeigth > mainHeigth + headerHeight
|
||||||
top = -headerHeight
|
@scrollPageHeader.css('transform', "translateY(#{-headerHeight}px)")
|
||||||
|
|
||||||
@scrollPageHeader.css('transform', "translateY(#{top}px)")
|
|
||||||
|
if scroll > headerHeight
|
||||||
|
scroll = headerHeight
|
||||||
|
|
||||||
|
if scroll is @scrollHeaderPos
|
||||||
|
return
|
||||||
|
|
||||||
|
#marginTop: 0 .. headerHeight
|
||||||
|
@main.css('margin-top', scroll)
|
||||||
|
# translateY: 0 .. -headerHeight
|
||||||
|
@ticketZoom.css('transform', "translateY(-#{scroll}px)")
|
||||||
|
# translateY: headerHeight .. 0
|
||||||
|
@scrollPageHeader.css('transform', "translateY(#{scroll - headerHeight}px)")
|
||||||
|
|
||||||
|
@scrollHeaderPos = scroll
|
||||||
|
|
||||||
render: =>
|
render: =>
|
||||||
|
|
||||||
|
|
|
@ -4290,7 +4290,7 @@ footer {
|
||||||
|
|
||||||
.tabsSidebar-sidebarSpacer {
|
.tabsSidebar-sidebarSpacer {
|
||||||
margin-right: $sidebarWidth;
|
margin-right: $sidebarWidth;
|
||||||
transition: margin 500ms;
|
transition: marginRight 500ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabsSidebar-sidebarSpacer.is-closed {
|
.tabsSidebar-sidebarSpacer.is-closed {
|
||||||
|
|
Loading…
Reference in a new issue