Guest User

Untitled

a guest
Sep 12th, 2015
96
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready( function() {
  2.  
  3. // Remove clickable links in menu
  4. // and fa-icon
  5. $('.menu a, .fetch-link').on('click', function(e) {
  6.   e.preventDefault();
  7. });
  8.  
  9. $(".hamburger-trigger").click(function(){
  10.   $(this).addClass("hamburger-trigger--active");
  11.   $('.menu').show();
  12.   $('.menu__bg').addClass("menu__bg--active");
  13.   $('.menu__container').addClass("menu__container--active");
  14. });
  15.  
  16. $(".menu__close").click(function(){
  17.   $(".hamburger-trigger").removeClass("hamburger-trigger--active");
  18.   $('.menu').hide();
  19.   $('.menu__bg').removeClass("menu__bg--active");
  20.   $('.menu__container').removeClass("menu__container--active");
  21.  
  22.   gallery.removeClass('transform-show');
  23. });
  24.  
  25.   var _gaq = _gaq || [];
  26.   _gaq.push(['_setAccount', 'UA-36251023-1']);
  27.   _gaq.push(['_setDomainName', 'jqueryscript.net']);
  28.   _gaq.push(['_trackPageview']);
  29.  
  30.   (function() {
  31.     var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  32.     ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  33.     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  34.   })();
  35.  
  36.   // Add HTML before and after article if there's more than 3 articles showing
  37.   var article = $('article.post');
  38.   if (article.length > 3) {
  39.     for (var i = 0; i < article.length; i+=3) {
  40.           article.slice(i, i+3).wrapAll('<section class="art-wrapper group"></section>');
  41.       }
  42.   }
  43.  
  44.   // When clicked, show gallery section
  45.   var open = false;
  46.   $(document).on('click', function(event) {
  47.      if(!open || (
  48.          $(event.target).closest('.project-info').length > 0 &&
  49.          $(event.target).closest('.menu_close_trans').length < 1
  50.      )) { return; }
  51.      $('.project-info').fadeOut();
  52.      $('.trans').fadeOut();
  53.      open = false;
  54.   }).on('click', '.fa-expand', function() {
  55.       $(this).closest('article').find('.project-info').fadeIn();
  56.      setTimeout(function() { open = true; });
  57.   });
  58.  
  59.   $('.fa-expand').on('click', function() {
  60.     $('.trans').fadeIn();
  61.   });
  62.  
  63.   var galleryShow = $('.gallery-show');
  64.   var gallery = $('#gallery');
  65.   galleryShow.on('click', function() {
  66.     gallery.toggleClass('transform-show');
  67.   });
  68.  
  69.   // Add a class to the FontAwesome icon when
  70.   // the screen is smaller than 800 pixels
  71.   var $window = $(window),
  72.   $wrapFa = $('.wrap .fa'),
  73.   $allArticles = $('article'),
  74.   faChange = function() {
  75.     if ($window.width() < 800) {
  76.  
  77.       $allArticles.each(function() {
  78.         $(this).find('.project-info').insertAfter($(this).find('.wrap .fa'));
  79.       });
  80.  
  81.       $wrapFa.removeClass('fa-expand');
  82.  
  83.       $wrapFa.addClass('fa-sort-desc');
  84.  
  85.     } else {
  86.       $wrapFa.addClass('fa-expand');
  87.       $wrapFa.removeClass('fa-sort-desc fa-sort-asc');
  88.       $('.trans').fadeOut();
  89.       $('.project-info').fadeOut();
  90.  
  91.       $allArticles.each(function() {
  92.         $(this).find('.project-info').insertAfter($(this).find('.wrap-all'));
  93.       });
  94.     }
  95.   };
  96.  
  97. // Toggle project-info
  98. $wrapFa.on('click', function() {
  99.   var $this = $(this);
  100.  
  101.   if ($window.width() < 800) {
  102.     $this.closest('article').find('.project-info').slideToggle().stop(false, true, false);
  103.     $this.closest('.wrap .fa').toggleClass('fa-sort-asc');
  104.   }
  105. });
  106. faChange();
  107. $(window).resize(faChange);
  108.  
  109. // Load the content from single.php
  110. // and apply it inside the .project-info section
  111. $.ajaxSetup({cache: false});
  112. $('.fetch-link').on('click', function() {
  113.   var post_link = $(this).attr('href');
  114.   $(this).find('.project-info').load(post_link);
  115. });
  116.  
  117. });
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×