adds fixed bar js

This commit is contained in:
Alberto Garcia Cabeza
2017-01-17 18:58:13 +01:00
parent 2aaf917510
commit d890b0a98b
2 changed files with 15 additions and 0 deletions

View File

@@ -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();
};

View 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()