Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready( function() {
- // Remove clickable links in menu
- // and fa-icon
- $('.menu a, .fetch-link').on('click', function(e) {
- e.preventDefault();
- });
- $(".hamburger-trigger").click(function(){
- $(this).addClass("hamburger-trigger--active");
- $('.menu').show();
- $('.menu__bg').addClass("menu__bg--active");
- $('.menu__container').addClass("menu__container--active");
- });
- $(".menu__close").click(function(){
- $(".hamburger-trigger").removeClass("hamburger-trigger--active");
- $('.menu').hide();
- $('.menu__bg').removeClass("menu__bg--active");
- $('.menu__container').removeClass("menu__container--active");
- gallery.removeClass('transform-show');
- });
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-36251023-1']);
- _gaq.push(['_setDomainName', 'jqueryscript.net']);
- _gaq.push(['_trackPageview']);
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
- // Add HTML before and after article if there's more than 3 articles showing
- var article = $('article.post');
- if (article.length > 3) {
- for (var i = 0; i < article.length; i+=3) {
- article.slice(i, i+3).wrapAll('<section class="art-wrapper group"></section>');
- }
- }
- // When clicked, show gallery section
- var open = false;
- $(document).on('click', function(event) {
- if(!open || (
- $(event.target).closest('.project-info').length > 0 &&
- $(event.target).closest('.menu_close_trans').length < 1
- )) { return; }
- $('.project-info').fadeOut();
- $('.trans').fadeOut();
- open = false;
- }).on('click', '.fa-expand', function() {
- $(this).closest('article').find('.project-info').fadeIn();
- setTimeout(function() { open = true; });
- });
- $('.fa-expand').on('click', function() {
- $('.trans').fadeIn();
- });
- var galleryShow = $('.gallery-show');
- var gallery = $('#gallery');
- galleryShow.on('click', function() {
- gallery.toggleClass('transform-show');
- });
- // Add a class to the FontAwesome icon when
- // the screen is smaller than 800 pixels
- var $window = $(window),
- $wrapFa = $('.wrap .fa'),
- $allArticles = $('article'),
- faChange = function() {
- if ($window.width() < 800) {
- $allArticles.each(function() {
- $(this).find('.project-info').insertAfter($(this).find('.wrap .fa'));
- });
- $wrapFa.removeClass('fa-expand');
- $wrapFa.addClass('fa-sort-desc');
- } else {
- $wrapFa.addClass('fa-expand');
- $wrapFa.removeClass('fa-sort-desc fa-sort-asc');
- $('.trans').fadeOut();
- $('.project-info').fadeOut();
- $allArticles.each(function() {
- $(this).find('.project-info').insertAfter($(this).find('.wrap-all'));
- });
- }
- };
- // Toggle project-info
- $wrapFa.on('click', function() {
- var $this = $(this);
- if ($window.width() < 800) {
- $this.closest('article').find('.project-info').slideToggle().stop(false, true, false);
- $this.closest('.wrap .fa').toggleClass('fa-sort-asc');
- }
- });
- faChange();
- $(window).resize(faChange);
- // Load the content from single.php
- // and apply it inside the .project-info section
- $.ajaxSetup({cache: false});
- $('.fetch-link').on('click', function() {
- var post_link = $(this).attr('href');
- $(this).find('.project-info').load(post_link);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement