adds fixed bar js
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
//= require valuation_budget_investment_form
|
||||
//= require valuation_spending_proposal_form
|
||||
//= require embed_video
|
||||
//= require fixed_bar
|
||||
//= require banners
|
||||
//= require social_share
|
||||
//= require custom
|
||||
@@ -70,6 +71,7 @@ var initialize_modules = function() {
|
||||
App.ValuationBudgetInvestmentForm.initialize();
|
||||
App.ValuationSpendingProposalForm.initialize();
|
||||
App.EmbedVideo.initialize();
|
||||
App.FixedBar.initialize();
|
||||
App.Banners.initialize();
|
||||
App.SocialShare.initialize();
|
||||
};
|
||||
|
||||
13
app/assets/javascripts/fixed_bar.js.coffee
Normal file
13
app/assets/javascripts/fixed_bar.js.coffee
Normal file
@@ -0,0 +1,13 @@
|
||||
App.FixedBar =
|
||||
initialize: ->
|
||||
$('[data-fixed-bar]').each ->
|
||||
$this = $(this)
|
||||
fixedBarTopPosition = $this.offset().top
|
||||
|
||||
$(window).on 'scroll', ->
|
||||
if $(window).scrollTop() > fixedBarTopPosition
|
||||
$this.addClass('is-fixed')
|
||||
$("#check-ballot").css({ 'display': "inline-block" });
|
||||
else
|
||||
$this.removeClass('is-fixed')
|
||||
$("#check-ballot").hide()
|
||||
Reference in New Issue
Block a user