Advertisement
Guest User

Untitled

a guest
Feb 5th, 2013
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  /*-----------------------------------------------------------------------------------
  2. /* Custom Scripts
  3. -----------------------------------------------------------------------------------*/
  4.  
  5. /* ----------------- Start Document ----------------- */
  6. (function($){
  7.     $(document).ready(function(){
  8.  
  9. /*----------------------------------------------------*/
  10. /*  Navigation
  11. /*----------------------------------------------------*/
  12.  
  13.     $(".menu li").hover(
  14.             function () {
  15.                 $(this).find('ul:first').css({
  16.                     visibility: "visible",
  17.                     display: "none"
  18.                 }).stop(true, true).fadeIn(100);
  19.             },
  20.             function () {
  21.                 $(this).find('ul:first').css({
  22.                     visibility: "visible",
  23.                     display: "block"
  24.                 }).stop(true, true).fadeOut(100);
  25.             }
  26.     );
  27.  
  28.     selectnav('responsive', {
  29.         label: 'Menu',
  30.         nested: true,
  31.         indent: '   '
  32.     });
  33.  
  34.  
  35. /*----------------------------------------------------*/
  36. /*  Carousel
  37. /*----------------------------------------------------*/
  38.  
  39. // Add classes for other carousels
  40. var $carousel = $('.recent-blog-jc, .recent-work-jc');
  41.  
  42. var scrollCount;
  43.  
  44. function adjustScrollCount() {
  45.     if( $(window).width() < 768 ) {
  46.         scrollCount = 1;
  47.     } else {
  48.         scrollCount = 3;
  49.     }
  50.  
  51. }
  52.  
  53. function adjustCarouselHeight() {
  54.  
  55.     $carousel.each(function() {
  56.         var $this    = $(this);
  57.         var maxHeight = -1;
  58.         $this.find('li').each(function() {
  59.             maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();
  60.         });
  61.         $this.height(maxHeight);
  62.     });
  63. }
  64. function initCarousel() {
  65.     adjustCarouselHeight();
  66.     adjustScrollCount();
  67.     var i = 0;
  68.     var g = {};
  69.     $carousel.each(function() {
  70.         i++;
  71.  
  72.         var $this = $(this);
  73.         g[i] = $this.jcarousel({
  74.             animation           : 600,
  75.             scroll              : scrollCount,
  76.             wrap : 'circular'
  77.         });
  78.         $this.jcarouselAutoscroll({ 'target': '+='+scrollCount,   'interval': 3000 });
  79.         $this.jcarousel('scroll', 0);
  80.          $this.prev().find('.jcarousel-prev').bind('active.jcarouselcontrol', function() {
  81.             $(this).addClass('active');
  82.         }).bind('inactive.jcarouselcontrol', function() {
  83.             $(this).removeClass('active');
  84.         }).jcarouselControl({
  85.             target: '-='+scrollCount,
  86.             carousel: g[i]
  87.         });
  88.  
  89.         $this.prev().find('.jcarousel-next').bind('active.jcarouselcontrol', function() {
  90.             $(this).addClass('active');
  91.         }).bind('inactive.jcarouselcontrol', function() {
  92.             $(this).removeClass('active');
  93.         }).jcarouselControl({
  94.             target: '+='+scrollCount,
  95.             carousel: g[i]
  96.         });
  97.  
  98.         $this.touchwipe({
  99.         wipeLeft: function() {
  100.             $this.jcarousel('scroll','+='+scrollCount);
  101.         },
  102.         wipeRight: function() {
  103.             $this.jcarousel('scroll','-='+scrollCount);
  104.         }
  105.     });
  106.  
  107.     });
  108. }
  109. $(window).load(function(){
  110.     initCarousel();
  111. });
  112.  
  113. $(window).resize(function () {
  114.     $carousel.each(function() {
  115.         var $this = $(this);
  116.         $this.jcarousel('destroy');
  117.     });
  118.     initCarousel();
  119. });
  120.  
  121.  
  122. /*----------------------------------------------------*/
  123. /*  Alert Boxes
  124. /*----------------------------------------------------*/
  125.  
  126.     $(document.body).pixusNotifications({
  127.         speed: 300,
  128.         animation: 'fadeAndSlide',
  129.         hideBoxes: false
  130.     });
  131.  
  132.  
  133. /*----------------------------------------------------*/
  134. /*  Tabs
  135. /*----------------------------------------------------*/
  136.  
  137.     var $tabsNav    = $('.tabs-nav'),
  138.         $tabsNavLis = $tabsNav.children('li'),
  139.         $tabContent = $('.tab-content');
  140.  
  141.     $tabsNav.each(function() {
  142.         var $this = $(this);
  143.  
  144.         $this.next().children('.tab-content').stop(true,true).hide()
  145.                                              .first().show();
  146.  
  147.         $this.children('li').first().addClass('active').stop(true,true).show();
  148.     });
  149.  
  150.     $tabsNavLis.on('click', function(e) {
  151.         var $this = $(this);
  152.  
  153.         $this.siblings().removeClass('active').end()
  154.              .addClass('active');
  155.  
  156.         $this.parent().next().children('.tab-content').stop(true,true).hide()
  157.                                                       .siblings( $this.find('a').attr('href') ).fadeIn();
  158.  
  159.         e.preventDefault();
  160.     });
  161.  
  162.  
  163. /*----------------------------------------------------*/
  164. /*  Accordion
  165. /*----------------------------------------------------*/
  166.  
  167. var $accor = $('.accordion');
  168.  
  169. $accor.each(function() {
  170.     $(this).addClass('ui-accordion ui-widget ui-helper-reset');
  171.     $(this).find('h3').addClass('ui-accordion-header ui-helper-reset ui-state-default ui-accordion-icons ui-corner-all');
  172.     $(this).find('div').addClass('ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom');
  173.     $(this).find("div").hide().first().show();
  174.     $(this).find("h3").first().removeClass('ui-accordion-header-active ui-state-active ui-corner-top').addClass('ui-accordion-header-active ui-state-active ui-corner-top');
  175.     $(this).find("span").first().addClass('ui-accordion-icon-active');
  176. });
  177.  
  178. $trigger = $accor.find('h3');
  179.  
  180. $trigger.on('click', function(e) {
  181.     var location = $(this).parent();
  182.  
  183.    if( $(this).next().is(':hidden') ) {
  184.         $triggerloc = $('h3',location);
  185.         $triggerloc.removeClass('ui-accordion-header-active ui-state-active ui-corner-top').next().slideUp(300);
  186.         $triggerloc.find('span').removeClass('ui-accordion-icon-active');
  187.         $(this).find('span').addClass('ui-accordion-icon-active');
  188.         $(this).addClass('ui-accordion-header-active ui-state-active ui-corner-top').next().slideDown(300);
  189.     }
  190.     e.preventDefault();
  191. });
  192.  
  193.  
  194. /*----------------------------------------------------*/
  195. /*  Toggle
  196. /*----------------------------------------------------*/
  197.  
  198.     $(".toggle-container").hide();
  199.     $(".trigger").toggle(function(){
  200.         $(this).addClass("active");
  201.         }, function () {
  202.         $(this).removeClass("active");
  203.     });
  204.     $(".trigger").click(function(){
  205.         $(this).next(".toggle-container").slideToggle();
  206.     });
  207.  
  208.     $(".trigger.opened").toggle(function(){
  209.         $(this).removeClass("active");
  210.         }, function () {
  211.         $(this).addClass("active");
  212.     });
  213.  
  214.     $(".trigger.opened").addClass("active").next(".toggle-container").show();
  215.  
  216.  
  217. /*----------------------------------------------------*/
  218. /*  Tooltip
  219. /*----------------------------------------------------*/
  220.  
  221.  $('.container').tooltip({
  222.       selector: "a.tooltip"
  223.     })
  224.  
  225. /*----------------------------------------------------*/
  226. /*  Isotope Portfolio Filter
  227. /*----------------------------------------------------*/
  228.  
  229.     $(window).load(function(){
  230.         $('#portfolio-wrapper').isotope({
  231.               itemSelector : '.isotope-item',
  232.                 layoutMode : 'fitRows'
  233.         });
  234.         $('#filters a.selected').trigger("click");
  235.     });
  236.     $('#filters a').click(function(e){
  237.         e.preventDefault();
  238.  
  239.         var selector = $(this).attr('data-option-value');
  240.         $('#portfolio-wrapper').isotope({ filter: selector });
  241.  
  242.         $(this).parents('ul').find('a').removeClass('selected');
  243.         $(this).addClass('selected');
  244.     });
  245.  
  246.  
  247. /*----------------------------------------------------*/
  248. /*  Skill Bar Animation
  249. /*----------------------------------------------------*/
  250.  
  251.         setTimeout(function(){
  252.  
  253.         $('.skill-bar .skill-bar-content').each(function() {
  254.             var me = $(this);
  255.             var perc = me.attr("data-percentage");
  256.  
  257.             var current_perc = 0;
  258.  
  259.             var progress = setInterval(function() {
  260.                 if (current_perc>=perc) {
  261.                     clearInterval(progress);
  262.                 } else {
  263.                     current_perc +=1;
  264.                     me.css('width', (current_perc)+'%');
  265.                 }
  266.  
  267.                 me.text((current_perc)+'%');
  268.  
  269.             }, 10);
  270.  
  271.         });
  272.  
  273.     },10);
  274.  
  275.  
  276. /*----------------------------------------------------*/
  277. /*  Fancybox2
  278. /*----------------------------------------------------*/
  279.  
  280.     $('[rel=fancybox]').fancybox({
  281.         type        : 'image',
  282.         openEffect  : 'elastic',
  283.         closeEffect : 'elastic',
  284.         nextEffect  : 'elastic',
  285.         prevEffect  : 'elastic',
  286.         helpers : {
  287.             title : {
  288.                 type : 'inside'
  289.             },
  290.             overlay : {
  291.                 css : {
  292.                     'background' : 'rgba(0, 0, 0, 0.85)'
  293.                 }
  294.             }
  295.         }
  296.     });
  297.  
  298.     $('[rel=fancybox-gallery]').fancybox({
  299.         openEffect  : 'elastic',
  300.         closeEffect : 'elastic',
  301.         nextEffect  : 'elastic',
  302.         prevEffect  : 'elastic',
  303.  
  304.         helpers : {
  305.             title : {
  306.                 type : 'inside'
  307.             },
  308.             buttons : {},
  309.             overlay : {
  310.                 css : {
  311.                     'background' : 'rgba(0, 0, 0, 0.85)'
  312.                 }
  313.             }
  314.         },
  315.  
  316.     });
  317.  
  318.  
  319. /*----------------------------------------------------*/
  320. /*  Layer Slider
  321. /*----------------------------------------------------*/
  322.  
  323.     $('#layerslider').layerSlider({
  324.         skin : 'fullwidth',
  325.         hoverPrevNext           : true,
  326.         navStartStop            : false,
  327.         navButtons              : false,
  328.         autoPlayVideos          : false,
  329.         animateFirstLayer       : false
  330.  
  331.     });
  332.  
  333. /*----------------------------------------------------*/
  334. /*  Portfolio Filters
  335. /*----------------------------------------------------*/
  336.  
  337.     function DropDown(el) {
  338.         this.dd = el;
  339.         this.opts = this.dd.find('ul.option-set > li');
  340.         this.placeholder = this.dd.children('span');
  341.         this.val = [];
  342.         this.index = [];
  343.         this.initEvents();
  344.     }
  345.  
  346.     DropDown.prototype = {
  347.         initEvents : function() {
  348.             var obj = this;
  349.  
  350.             obj.dd.on('click', function(event){
  351.                 $(this).toggleClass('active');
  352.                 event.stopPropagation();
  353.             });
  354.         obj.opts.on('click',function(){
  355.                 var opt = $(this);
  356.                 obj.val = opt.text();
  357.                 obj.index = opt.index();
  358.                 obj.placeholder.text('' + obj.val);
  359.             });
  360.         }
  361.     }
  362.  
  363.     $(function() {
  364.  
  365.         var dd = new DropDown( $('#filters') );
  366.  
  367.         $(document).click(function() {
  368.             $('.filters-dropdown').removeClass('active');
  369.         });
  370.  
  371.         $(".option-set").click(function() {
  372.             $('.filters-dropdown').toggleClass('active');
  373.         });
  374.  
  375.     });
  376.  
  377.  
  378. /* ------------------ End Document ------------------ */
  379. });
  380.  
  381. })(this.jQuery);
  382.  
  383.  
  384.  
  385. (function()
  386. {
  387.     $.fn.pixusNotifications = function(options)
  388.     {
  389.         var defaults = {
  390.             speed: 200,
  391.             animation: 'fade',
  392.             hideBoxes: false
  393.         };
  394.  
  395.         var options = $.extend({}, defaults, options);
  396.  
  397.         return this.each(function()
  398.         {
  399.             var wrapper = $(this),
  400.                 notification = wrapper.find('.notification'),
  401.                 content = notification.find('p'),
  402.                 title = content.find('strong'),
  403.                 closeBtn = $('<a class="close" href="#"><i class="icon-remove"></i></a>');
  404.  
  405.             $(document.body).find('.notification').each(function(i)
  406.             {
  407.                 var i = i+1;
  408.                 $(this).attr('id', 'notification_'+i);
  409.             });
  410.  
  411.             notification.filter('.closeable').append(closeBtn);
  412.  
  413.             closeButton = notification.find('> .close');
  414.  
  415.             closeButton.click(function()
  416.             {
  417.                 hideIt( $(this).parent() );
  418.                 return false;
  419.             });
  420.  
  421.             function hideIt(object)
  422.             {
  423.                 switch(options.animation)
  424.                 {
  425.                     case 'fade': fadeIt(object);     break;
  426.                     case 'slide': slideIt(object);     break;
  427.                     case 'box': boxAnimIt(object);     break;
  428.                     case 'fadeAndSlide': fadeItSlideIt(object);     break;
  429.                     default: fadeItSlideIt(object);
  430.                 }
  431.             };
  432.  
  433.             function fadeIt(object)
  434.             {   object
  435.                 .fadeOut(options.speed);
  436.             }
  437.             function slideIt(object)
  438.             {   object
  439.                 .slideUp(options.speed);
  440.             }
  441.             function fadeItSlideIt(object)
  442.             {   object
  443.                 .fadeTo(options.speed, 0, function() { slideIt(object) } );
  444.             }
  445.             function boxAnimIt(object)
  446.             {   object
  447.                 .hide(options.speed);
  448.             }
  449.  
  450.             if (options.hideBoxes){}
  451.  
  452.             else if (! options.hideBoxes)
  453.             {
  454.                 notification.css({'display': 'block', 'visiblity': 'visible'});
  455.             }
  456.  
  457.         });
  458.     };
  459. })();
  460.  
  461.  
  462. /**
  463.  * jQuery Plugin to obtain touch gestures from iPhone, iPod Touch, iPad, and Android mobile phones
  464.  * Common usage: wipe images (left and right to show the previous or next image)
  465.  *
  466.  * @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
  467.  */
  468. (function($){$.fn.touchwipe=function(settings){var config={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(settings)$.extend(config,settings);this.each(function(){var startX;var startY;var isMoving=false;function cancelTouch(){this.removeEventListener('touchmove',onTouchMove);startX=null;isMoving=false}function onTouchMove(e){if(config.preventDefaultEvents){e.preventDefault()}if(isMoving){var x=e.touches[0].pageX;var y=e.touches[0].pageY;var dx=startX-x;var dy=startY-y;if(Math.abs(dx)>=config.min_move_x){cancelTouch();if(dx>0){config.wipeLeft()}else{config.wipeRight()}}else if(Math.abs(dy)>=config.min_move_y){cancelTouch();if(dy>0){config.wipeDown()}else{config.wipeUp()}}}}function onTouchStart(e){if(e.touches.length==1){startX=e.touches[0].pageX;startY=e.touches[0].pageY;isMoving=true;this.addEventListener('touchmove',onTouchMove,false)}}if('ontouchstart'in document.documentElement){this.addEventListener('touchstart',onTouchStart,false)}});return this}})(jQuery);
  469.  
  470.  
  471. /* ===========================================================
  472.  * bootstrap-tooltip.js v2.0.4
  473.  * http://twitter.github.com/bootstrap/javascript.html#tooltips
  474.  * Inspired by the original jQuery.tipsy by Jason Frame
  475.  * ===========================================================
  476.  * Copyright 2012 Twitter, Inc.
  477.  *
  478.  * Licensed under the Apache License, Version 2.0 (the "License");
  479.  * you may not use this file except in compliance with the License.
  480.  * You may obtain a copy of the License at
  481.  *
  482.  * http://www.apache.org/licenses/LICENSE-2.0
  483.  *
  484.  * Unless required by applicable law or agreed to in writing, software
  485.  * distributed under the License is distributed on an "AS IS" BASIS,
  486.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  487.  * See the License for the specific language governing permissions and
  488.  * limitations under the License.
  489.  * ========================================================== */
  490.  
  491. !function(b){var a=function(d,c){this.init("tooltip",d,c)};a.prototype={constructor:a,init:function(f,e,d){var g,c;this.type=f;this.$element=b(e);this.options=this.getOptions(d);this.enabled=true;if(this.options.trigger!="manual"){g=this.options.trigger=="hover"?"mouseenter":"focus";c=this.options.trigger=="hover"?"mouseleave":"blur";this.$element.on(g,this.options.selector,b.proxy(this.enter,this));this.$element.on(c,this.options.selector,b.proxy(this.leave,this))}this.options.selector?(this._options=b.extend({},this.options,{trigger:"manual",selector:""})):this.fixTitle()},getOptions:function(c){c=b.extend({},b.fn[this.type].defaults,c,this.$element.data());if(c.delay&&typeof c.delay=="number"){c.delay={show:c.delay,hide:c.delay}}return c},enter:function(d){var c=b(d.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.show){c.show()}else{c.hoverState="in";setTimeout(function(){if(c.hoverState=="in"){c.show()}},c.options.delay.show)}},leave:function(d){var c=b(d.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.hide){c.hide()}else{c.hoverState="out";setTimeout(function(){if(c.hoverState=="out"){c.hide()}},c.options.delay.hide)}},show:function(){var g,c,i,e,h,d,f;if(this.hasContent()&&this.enabled){g=this.tip();this.setContent();if(this.options.animation){g.addClass("fade")}d=typeof this.options.placement=="function"?this.options.placement.call(this,g[0],this.$element[0]):this.options.placement;c=/in/.test(d);g.remove().css({top:0,left:0,display:"block"}).appendTo(c?this.$element:document.body);i=this.getPosition(c);e=g[0].offsetWidth;h=g[0].offsetHeight;switch(c?d.split(" ")[1]:d){case"bottom":f={top:i.top+i.height,left:i.left+i.width/2-e/2};break;case"top":f={top:i.top-h,left:i.left+i.width/2-e/2};break;case"left":f={top:i.top+i.height/2-h/2,left:i.left-e};break;case"right":f={top:i.top+i.height/2-h/2,left:i.left+i.width};break}g.css(f).addClass(d).addClass("in")}},setContent:function(){var c=this.tip();c.find(".tooltip-inner").html(this.getTitle());c.removeClass("fade in top bottom left right")},hide:function(){var c=this,d=this.tip();d.removeClass("in");function e(){var f=setTimeout(function(){d.off(b.support.transition.end).remove()},500);d.one(b.support.transition.end,function(){clearTimeout(f);d.remove()})}b.support.transition&&this.$tip.hasClass("fade")?e():d.remove()},fixTitle:function(){var c=this.$element;if(c.attr("title")||typeof(c.attr("data-original-title"))!="string"){c.attr("data-original-title",c.attr("title")||"").removeAttr("title")}},hasContent:function(){return this.getTitle()},getPosition:function(c){return b.extend({},(c?{top:0,left:0}:this.$element.offset()),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var e,c=this.$element,d=this.options;e=c.attr("data-original-title")||(typeof d.title=="function"?d.title.call(c[0]):d.title);e=e.toString().replace(/(^\s*|\s*$)/,"");return e},tip:function(){return this.$tip=this.$tip||b(this.options.template)},validate:function(){if(!this.$element[0].parentNode){this.hide();this.$element=null;this.options=null}},enable:function(){this.enabled=true},disable:function(){this.enabled=false},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}};b.fn.tooltip=function(c){return this.each(function(){var f=b(this),e=f.data("tooltip"),d=typeof c=="object"&&c;if(!e){f.data("tooltip",(e=new a(this,d)))}if(typeof c=="string"){e[c]()}})};b.fn.tooltip.Constructor=a;b.fn.tooltip.defaults={animation:true,delay:0,selector:false,placement:"top",trigger:"hover",title:"",template:'<div class="ui-tooltip ui-widget ui-corner-all ui-widget-content"><div class="tooltip-arrow arrow bottom center"></div><div class="tooltip-inner"></div></div>'}}(window.jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement