mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add scrollIntoView behaviour.
This commit is contained in:
parent
399a9ed604
commit
1424ae686a
2 changed files with 12 additions and 11 deletions
|
@ -1,10 +1,10 @@
|
||||||
script(type="text/javascript").
|
//- script(type="text/javascript").
|
||||||
if (window.location.hash) {
|
//- if (window.location.hash) {
|
||||||
setTimeout(function(){
|
//- setTimeout(function(){
|
||||||
tabID = window.location.hash.replace(/#!?/, '')
|
//- tabID = window.location.hash.replace(/#!?/, '')
|
||||||
tab = document.getElementById(tabID)
|
//- tab = document.getElementById(tabID)
|
||||||
if (tab && typeof(tab) != 'undefined' && tab != null) {
|
//- if (tab && typeof(tab) != 'undefined' && tab != null) {
|
||||||
tab.setAttribute('active', true)
|
//- tab.setAttribute('active', true)
|
||||||
}
|
//- }
|
||||||
}, 500);
|
//- }, 500);
|
||||||
}
|
//- }
|
|
@ -12,6 +12,7 @@ define [
|
||||||
tab.bookmarkableTabId == hash
|
tab.bookmarkableTabId == hash
|
||||||
if matchingTab?
|
if matchingTab?
|
||||||
matchingTab.select()
|
matchingTab.select()
|
||||||
|
el.children()[0].scrollIntoView({ behavior: "smooth" })
|
||||||
|
|
||||||
App.directive "bookmarkableTab", ($location) ->
|
App.directive "bookmarkableTab", ($location) ->
|
||||||
restrict: "A"
|
restrict: "A"
|
||||||
|
@ -22,7 +23,7 @@ define [
|
||||||
if tabScope? and tabId? and tabId != ""
|
if tabScope? and tabId? and tabId != ""
|
||||||
tabScope.bookmarkableTabId = tabId
|
tabScope.bookmarkableTabId = tabId
|
||||||
tabScope.$watch "active", (isActive, wasActive) ->
|
tabScope.$watch "active", (isActive, wasActive) ->
|
||||||
if isActive and !wasActive
|
if isActive and !wasActive and $location.hash() != tabId
|
||||||
$location.hash tabId
|
$location.hash tabId
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue