Sha256: 48ac67668ee91b1475527b90ecad71eaab411cc67b36b7b37ae43be46ab0f589

Contents?: true

Size: 1.03 KB

Versions: 8

Compression:

Stored size: 1.03 KB

Contents

module Frontview
  module Contents
    class MainContent < Rails::Generators::Base
      def write_in_main_file
        File.open("app/javascript/packs/main.js", "w+") {
          |file| file.puts(
"// Sticky Header
$(window).scroll(function() {
  if ($(window).scrollTop() > 100) {
    $('.main_h').addClass('sticky');
  } else {
    $('.main_h').removeClass('sticky');
  }
});

// Mobile Navigation
$('.mobile-toggle').click(function() {
  if ($('.main_h').hasClass('open-nav')) {
    $('.main_h').removeClass('open-nav');
  } else {
    $('.main_h').addClass('open-nav');
  }
});

$('.main_h li a').click(function() {
  if ($('.main_h').hasClass('open-nav')) {
    $('.navigation').removeClass('open-nav');
    $('.main_h').removeClass('open-nav');
  }
});

// navigation scroll
$('nav a').click(function(event) {
  var id = $(this).attr(\"href\");
  var offset = 70;
  var target = $(id).offset().top - offset;
  $('html, body').animate({
    scrollTop: target
  }, 500);
  event.preventDefault();
});"
          )
        }
      end 
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
frontview-2.2.7 lib/frontview/contents/main_content.rb
frontview-2.2.6 lib/frontview/contents/main_content.rb
frontview-2.2.5 lib/frontview/contents/main_content.rb
frontview-2.2.4 lib/frontview/contents/main_content.rb
frontview-2.2.4.pre.beta lib/frontview/contents/main_content.rb
frontview-2.2.3.pre.beta lib/frontview/contents/main_content.rb
frontview-2.2.2 lib/frontview/contents/main_content.rb
frontview-2.2.1 lib/frontview/contents/main_content.rb