Fix anchor links on /about
This commit is contained in:
parent
e7f79ab721
commit
634cc1fb15
1 changed files with 15 additions and 28 deletions
|
@ -8,12 +8,7 @@ module.exports = class AboutView extends RootView
|
||||||
logoutRedirectURL: false
|
logoutRedirectURL: false
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'click #mission-link': 'onClickMissionLink'
|
'click #fixed-nav a': 'onClickFixedNavLink'
|
||||||
'click #team-link': 'onClickTeamLink'
|
|
||||||
'click #community-link': 'onClickCommunityLink'
|
|
||||||
'click #story-link': 'onClickStoryLink'
|
|
||||||
'click #jobs-link': 'onClickJobsLink'
|
|
||||||
'click #contact-link': 'onClickContactLink'
|
|
||||||
'click .screen-thumbnail': 'onClickScreenThumbnail'
|
'click .screen-thumbnail': 'onClickScreenThumbnail'
|
||||||
'click #carousel-left': 'onLeftPressed'
|
'click #carousel-left': 'onLeftPressed'
|
||||||
'click #carousel-right': 'onRightPressed'
|
'click #carousel-right': 'onRightPressed'
|
||||||
|
@ -44,29 +39,21 @@ module.exports = class AboutView extends RootView
|
||||||
keyboard: false
|
keyboard: false
|
||||||
})
|
})
|
||||||
|
|
||||||
onClickMissionLink: (event) ->
|
afterInsert: ->
|
||||||
event.preventDefault()
|
# scroll to the current hash, once everything in the browser is set up
|
||||||
@scrollToLink('#mission')
|
f = =>
|
||||||
|
return if @destroyed
|
||||||
|
link = $(document.location.hash)
|
||||||
|
if link.length
|
||||||
|
@scrollToLink(document.location.hash, 0)
|
||||||
|
_.delay(f, 100)
|
||||||
|
|
||||||
onClickTeamLink: (event) ->
|
onClickFixedNavLink: (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault() # prevent default page scroll
|
||||||
@scrollToLink('#team')
|
link = $(event.target).closest('a')
|
||||||
|
target = link.attr('href')
|
||||||
onClickCommunityLink: (event) ->
|
history.replaceState(null, null, "about#{target}") # update hash without triggering page scroll
|
||||||
event.preventDefault()
|
@scrollToLink(target)
|
||||||
@scrollToLink('#community')
|
|
||||||
|
|
||||||
onClickStoryLink: (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
@scrollToLink('#story')
|
|
||||||
|
|
||||||
onClickJobsLink: (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
@scrollToLink('#jobs')
|
|
||||||
|
|
||||||
onClickContactLink: (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
@scrollToLink('#contact')
|
|
||||||
|
|
||||||
onRightPressed: (event) ->
|
onRightPressed: (event) ->
|
||||||
# Special handling, otherwise after you click the control, keyboard presses move the slide twice
|
# Special handling, otherwise after you click the control, keyboard presses move the slide twice
|
||||||
|
|
Reference in a new issue