Advertisement
Guest User

Untitled

a guest
Jul 14th, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Oldal = {
  2.     init : function() {
  3.         this.initInstagram();
  4.         this.initFlexsliders();
  5.         this.initTooltips();
  6.         this.initPopovers();
  7.         this.resizeContent();
  8.         this.calculateMainMargin();
  9.  
  10.         $('.search-trigger').click(this.toggleSearch);
  11.  
  12.         $('.custom-select').selectBoxIt({
  13.            autoWidth: false
  14.         });
  15.         $('.main-nav >li').each(this.addMobileButton);
  16.         $(window).scroll(this.moveHeader);
  17.         this.initFancybox();
  18.     },
  19.     initInstagram : function() {
  20.         $('.insta').simpleInstagramFancybox({
  21.             mode : 'user',
  22.             accessToken : '730091552.e204b44.413a8d85e00f48d9a6985bf689c76a1c', // This a mandatory setting that allows you to specify a user token.
  23.             userID : '1138644', // This is a setting that you have to use if your using "user" mode. Default is "For stunning photography – Kevin Burg".
  24.             speed: 700, // Sets the speed of the images fade in effect, default is 700.
  25.             delayInterval : 80, // Sets the interval of the delay between photos appearing, default is 80.
  26.             captionOn : true, // Allows you to turn on captions
  27.             tags: "", // Allows you limit photos based on a given tag
  28.             numberOfImages: 8 // Number of images to display
  29.         });
  30.     },
  31.     initFancybox : function() {
  32.         $('.trigger-fancybox').fancybox({
  33.             padding : 0,
  34.             autoResize: true,
  35.             arrows : false,
  36.             closeBtn : false,
  37.             prevEffect : 'fade',
  38.             nextEffect : 'fade',
  39.             helpers : {
  40.                 buttons : {
  41.                     position : 'top'
  42.                 }
  43.             },
  44.             beforeShow: function() {
  45.                 var closeButton = $('<button class="oldal-close oldal-fancy"><i class="entyp-cancel-1"></i></button>');
  46.                 var fullscreenButton = $('<button class="oldal-fullscreen oldal-fancy"><i class="entyp-resize-full-1"></i></button>');
  47.                 closeButton.click(function() {
  48.                     $.fancybox.close();
  49.                 });
  50.                 fullscreenButton.click(function() {
  51.                     $.fancybox.toggle();
  52.                 });
  53.                 $.fancybox.wrap.append(closeButton);
  54.                 $.fancybox.wrap.append(fullscreenButton);
  55.             }
  56.         });
  57.         $('.fancybox-product').fancybox({
  58.             padding : 0,
  59.             autoResize: true,
  60.             arrows : false,
  61.             closeBtn : false,
  62.             prevEffect : 'fade',
  63.             nextEffect : 'fade',
  64.             helpers : {
  65.                 buttons : {
  66.                     position : 'top'
  67.                 }
  68.             },
  69.             beforeShow: function() {
  70.                 var closeButton = $('<button class="oldal-close oldal-fancy"><i class="entyp-cancel-1"></i></button>');
  71.                 var fullscreenButton = $('<button class="oldal-fullscreen oldal-fancy"><i class="entyp-resize-full-1"></i></button>');
  72.                 closeButton.click(function() {
  73.                     $.fancybox.close();
  74.                 });
  75.                 fullscreenButton.click(function() {
  76.                     $.fancybox.toggle();
  77.                 });
  78.                 $.fancybox.wrap.append(closeButton);
  79.                 $.fancybox.wrap.append(fullscreenButton);
  80.             }
  81.         });
  82.     },
  83.     calculateMainMargin : function() {
  84.         var mainWrap = $('.main-wrap');
  85.         var height = 0;
  86.         if(mainWrap.length) {
  87.             $('.main-footer').length && (height = $('.main-footer').outerHeight());
  88.             $('.simple-footer').length && (height = $('.simple-footer').outerHeight());
  89.             $('body').css({
  90.                "padding-bottom" : height + "px"
  91.             });
  92.         }
  93.     },
  94.     addMobileButton : function() {
  95.         var el = $(this);
  96.         var button = $('<button class="dropdown-toggle"><i class="glyphicon glyphicon-chevron-down"></i></button>');
  97.         if(el.find('>ul').length) {
  98.             el.append(button);
  99.             button.click(Oldal.mobileDropdown);
  100.         }
  101.     },
  102.     mobileDropdown : function() {
  103.         var submenu = $(this).parent().find(">ul");
  104.         if(submenu.is(':visible')) {
  105.             submenu.slideUp(300);
  106.             $(this).html('<i class="glyphicon glyphicon-chevron-down"></i>');
  107.         } else {
  108.             submenu.slideDown(300);
  109.             $(this).html('<i class="glyphicon glyphicon-chevron-up"></i>');
  110.         }
  111.     },
  112.     toggleSearch : function(e) {
  113.         var searchWrap = $('.search-wrap');
  114.         if(searchWrap.is(':visible')) {
  115.             searchWrap.slideUp(300);
  116.         } else {
  117.             searchWrap.slideDown(300);
  118.             searchWrap.find('.form-control').focus();
  119.         }
  120.         e.preventDefault();
  121.     },
  122.     hideBigSearch : function() {
  123.         if($(window).width() < 768) {
  124.             $('.search-wrap').hide();
  125.         }
  126.     },
  127.     initFlexsliders : function() {
  128.         $('.recent-work').flexslider({
  129.             animation: "slide",
  130.             controlNav: false,
  131.             directionNav : false,
  132.             animationLoop: true,
  133.             slideshow: false
  134.         });
  135.         $('.recent-work .slider-controls .left').click(function() {
  136.             $('.recent-work').flexslider('prev');
  137.         });
  138.         $('.recent-work .slider-controls .right').click(function() {
  139.             $('.recent-work').flexslider('next');
  140.         });
  141.         $('.post-images').flexslider({
  142.             animation: "slide",
  143.             controlNav: false,
  144.             directionNav : false,
  145.             animationLoop: true,
  146.             slideshow: false
  147.         });
  148.         $('.post-images .slider-controls .left').click(function() {
  149.             $('.post-images').flexslider('prev');
  150.         });
  151.         $('.post-images .slider-controls .right').click(function() {
  152.             $('.post-images').flexslider('next');
  153.         });
  154.         $('.recent-posts').flexslider({
  155.             animation: "slide",
  156.             controlNav: false,
  157.             directionNav : false,
  158.             animationLoop: true,
  159.             slideshow: false
  160.         });
  161.         $('.recent-posts .slider-controls .left').click(function() {
  162.             $('.recent-posts').flexslider('prev');
  163.         });
  164.         $('.recent-posts .slider-controls .right').click(function() {
  165.             $('.recent-posts').flexslider('next');
  166.         });
  167.         $('.product-slider').flexslider({
  168.             animation: "slide",
  169.             controlNav: true,
  170.             directionNav : false,
  171.             animationLoop: true,
  172.             slideshow: false
  173.         });
  174.         $('.similar-slider').flexslider({
  175.             animation: "slide",
  176.             controlNav: false,
  177.             directionNav : false,
  178.             animationLoop: true,
  179.             slideshow: false
  180.         });
  181.         $('.similar-slider .slider-controls .left').click(function() {
  182.             $('.similar-slider').flexslider('prev');
  183.         });
  184.         $('.similar-slider .slider-controls .right').click(function() {
  185.             $('.similar-slider').flexslider('next');
  186.         });
  187.     },
  188.     initTooltips : function() {
  189.         $('.oldal-tooltip').tooltip();
  190.     },
  191.     initPopovers : function() {
  192.         $('.oldal-popover').popover();
  193.     },
  194.     resizeContent : function() {
  195.         $('.main-container').css('min-height', ($(window).height() - $('.navbar').outerHeight() - $('.main-footer').outerHeight()) + "px");
  196.     },
  197.     moveHeader : function() {
  198.         var firstHeader = $('.navbar .normal-color');
  199.         var secondHeader = $('.navbar .inverse-color');
  200.         var searchWrap = $('.navbar .search-wrap');
  201.         var scrollTop = $(window).scrollTop();
  202.         var secondHeaderH = secondHeader.outerHeight();
  203.         var firstHeaderH = firstHeader.outerHeight();
  204.         var headerSlider = $('.header-slider');
  205.         var topOffset = firstHeaderH;
  206.         if(headerSlider.length) {
  207.             topOffset = headerSlider.outerHeight();
  208.         }
  209.         if(scrollTop >= topOffset) {
  210.             secondHeader.addClass('sticky');
  211.             firstHeader.addClass('opacity');
  212.             searchWrap.addClass('sticky');
  213.             searchWrap.css('top', secondHeaderH + "px");
  214.             $("body").css('padding-top', secondHeaderH+'px');
  215.         } else {
  216.             firstHeader.removeClass('opacity');
  217.             secondHeader.removeClass('sticky');
  218.             searchWrap.removeClass('sticky');
  219.             searchWrap.css('top', "100%");
  220.             $("body").css('padding-top', 0);
  221.         }
  222.     }
  223. };
  224.  
  225. $(document).ready(function() {
  226.     Oldal.init();
  227. });
  228. $(window).resize(function() {
  229.     Oldal.hideBigSearch();
  230.     Oldal.resizeContent();
  231. });
  232.  
  233.  
  234. $(".post").fitVids();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement