www.gusucode.com > 200套html5精品模板1_50 > 200套html5精品模板1_50/013/blue/js/custom.js

     jQuery.noConflict()(function($){
  $(document).ready(function($) {
  /*-------------------------------------------------------------*/
  /*				ONE BY ONE JQUERY SLIDER STARTS				 */
  /*-------------------------------------------------------------*/
  if ( $( '#banner' ).length && jQuery().oneByOne ) {
      $('#banner').oneByOne({
			className: 'oneByOne1',	             
			easeType: 'random',
			slideShow: true
		}); 
}
  /*-------------------------------------------------------------*/
  /*				ONE BY ONE JQUERY SLIDER ENDS				 */
  /*-------------------------------------------------------------*/

  
   /*-------------------------------------------------------------*/
  /*			KWICKS (ACCORDION) JQUERY SLIDER STARTS			 */
  /*-------------------------------------------------------------*/
    if ( $( '.kwicks' ).length && jQuery().oneByOne ) {
	$('.kwicks').kwicks({
		max: 480,
		spacing: 0,
		duration: 500,
		easing: 'easeOutCirc'
	});
	jQuery("ul.kwicks").each(function () {
	jQuery("ul.kwicks").hover(function() {
	jQuery('.accordian-slider-caption').stop().animate({opacity: 0.9, bottom: '0%'}, 500 );

	},function(){
	jQuery('.accordian-slider-caption').stop().animate({opacity: 0, bottom: '-35%'}, 500 );

	});
	});
	}
   /*-------------------------------------------------------------*/
  /*			KWICKS (ACCORDION) JQUERY SLIDER ENDS			 */
  /*-------------------------------------------------------------*/
 	
   /*-------------------------------------------------------------*/
  /*			GRID HOMEPAGE JQUERY HOVER STARTS			 */
  /*-------------------------------------------------------------*/		
		$(".item-hover").hover(function(){
		$(this).find(".portfolio-thumbnail").stop(true, true).animate({ opacity: 'show',easing    : 'easeOutBounce', }, 1000);
	}, function() {
		$(this).find(".portfolio-thumbnail").stop(true, true).animate({ opacity: 'hide',easing    : 'easeOutBounce', }, 1000);		
	});		
   /*-------------------------------------------------------------*/
  /*			GRID HOMEPAGE JQUERY HOVER ENDS			 */
  /*-------------------------------------------------------------*/		
   /*-------------------------------------------------------------*/
  /*			SERVICE LIST FADE OUT STARTS					 */
  /*-------------------------------------------------------------*/	
  function listfades(a){
	jQuery(a).find(">li").each(function(){
		var b=jQuery(this);b.hover(function(){
			var b=jQuery(this);b.addClass("listover");b.find("img:first").addClass("listovereffect");jQuery(a).find(">li").each(function(a){
				var b=jQuery(this);b.stop();if(!b.hasClass("listover"))b.find("img:first").animate({
					opacity:.5
				},
				{
					duration:300,
					queue:false
				});else b.find("img:first").animate({
					opacity:1
				},
				{
					duration:300,
					queue:false
				})
			})
		},
		function(){
			var a=jQuery(this);a.removeClass("listover");a.find("img:first").removeClass("listovereffect");a.siblings().each(function(){
				var a=jQuery(this);a.stop();a.find("img:first").animate({
					opacity:1
				},
				{
					duration:300,
					queue:false
				})
			});a.stop();a.find("img:first").animate({
				opacity:1
			},
			{
				duration:300,
				queue:false
			})
		})
	})
}
	listfades(".clients");
  /*-------------------------------------------------------------*/
  /*			SERVICE LIST FADE OUT ENDS					 */
  /*-------------------------------------------------------------*/	
    /*-------------------------------------------------------------*/
  /*			CAMERA SLIDER 1 AND 2JQUERY STARTS				*/
  /*-------------------------------------------------------------*/	
 if ( $( '#camera_wrap_1' ).length && jQuery()) {
 $('#camera_wrap_1').camera({
	height: '350px',
	loader: 'bar',
	pagination: false,
	thumbnails: true
 });
 }
 
  if ( $( '#camera_wrap_2' ).length && jQuery()) {
 $('#camera_wrap_2').camera({
	height: '350px',
	thumbnails: true
 });
 }
 
     /*-------------------------------------------------------------*/
  /*			CAMERA SLIDER 1 AND 2JQUERY ENDS				*/
  /*-------------------------------------------------------------*/	
  
      /*-------------------------------------------------------------*/
  /*			HOMEPAGE SERVICE TOGGLE STARTS						*/
  /*-------------------------------------------------------------*/	
$.localScroll({
		target: '#services-container', // could be a selector or a jQuery object too.
		queue:true,
		duration:1000,
		hash:true,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modified
		},
		onAfter:function( anchor, settings ){
			// The 'this' contains the scrolled element (#content)
		}
	});
	
      /*-------------------------------------------------------------*/
  /*			HOMEPAGE SERVICE TOGGLE ENDS						*/
  /*-------------------------------------------------------------*/	
  
  /*-------------------------------------------------------------*/
  /*			AUDIO VIDEO JQUERY STARTS						*/
  /*-------------------------------------------------------------*/	
$('audio,video').mediaelementplayer();
  /*-------------------------------------------------------------*/
  /*			AUDIO VIDEO JQUERY ENDS						*/
  /*-------------------------------------------------------------*/	 
 
    /*-------------------------------------------------------------*/
  /*			JQUERY TABS & ACCORDIONS MENU STARTS   			  */
  /*-------------------------------------------------------------*/	
	(function() {

		var $tabsNav    = $('.tabs-nav'),
			$tabsNavLis = $tabsNav.children('li'),
			$tabContent = $('.tab-content');

		$tabContent.hide();
		$tabsNavLis.first().addClass('active').show();
		$tabContent.first().show();

		$tabsNavLis.on('click', function(e) {
			var $this = $(this);

			$tabsNavLis.removeClass('active');
			$this.addClass('active');
			$tabContent.hide();
			
			$( $this.find('a').attr('href') ).fadeIn(700);

			e.preventDefault();
		});

	})();
	
	   initAccordion();
	
function initAccordion() {
	jQuery('.accordion-item').each(function(i) {
		var item=jQuery(this);
		item.find('.accordion-content').slideUp(0);
		item.find('.accordion-switch').click(function() {
		 var displ = item.find('.accordion-content').css('display');
		 item.closest('ul').find('.accordion-switch').each(function() {
		  var li = jQuery(this).closest('li');
		  li.find('.accordion-content').slideUp(300);
		  jQuery(this).parent().removeClass("selected");
		 });
		 if (displ=="block") {
		  item.find('.accordion-content').slideUp(300) 
		  item.removeClass("selected");
		 } else {
		  item.find('.accordion-content').slideDown(300) 
		  item.addClass("selected");
		 }
		});
	});
}
    /*-------------------------------------------------------------*/
  /*			JQUERY TABS & ACCORDIONS MENU ENDS   			  */
  /*-------------------------------------------------------------*/

    /*-------------------------------------------------------------*/
  /*			JQUERY GOOGLE MAPS STARTS			   			  */
  /*-------------------------------------------------------------*/	  

if ( $( '#map' ).length && jQuery() ) {
  /*GOOGLE MAPS*/
var $map = $('#map');
		 
			$map.gMap({
				
				address: 'Level 13, 2 Elizabeth St, Melbourne Victoria 3000 Australia',
				 
				zoom: 18,
				markers: [
					{ 'address' : 'Level 13, 2 Elizabeth St, Melbourne Victoria 3000 Australia' },
					 
				]
				
			});

		 } 
    /*-------------------------------------------------------------*/
  /*			JQUERY GOOGLE MAPS ENDS			   			  */
  /*-------------------------------------------------------------*/	

    /*-------------------------------------------------------------*/
  /*			JQUERY VIDEO FITS STARTS				   		  */
  /*-------------------------------------------------------------*/	    
 $(".container").fitVids();

     /*-------------------------------------------------------------*/
  /*			JQUERY VIDEO FITS ENDS				   		  */
  /*-------------------------------------------------------------*/	 
	
	
/*-------------------------------------------------------------*/
  /*			JQUERY PRETTYPHOTO CALL STARTS 			   		  */
  /*-------------------------------------------------------------*/	 
	$("a[data-rel^='prettyPhoto']").prettyPhoto({
		overlay_gallery: false
	});
	
/*-------------------------------------------------------------*/
  /*			JQUERY PRETTYPHOTO CALL ENDS 			   		  */
  /*-------------------------------------------------------------*/	 	
 

	
/*-------------------------------------------------------------*/
  /*			JQUERY PORTFOLIO HOVER  STARTS 		   		  */
  /*-------------------------------------------------------------*/	 
		if ( $( '.portfolio-item-hover-content' ).length && jQuery() ) {
		function hover_effect() {  
	$('.portfolio-item-hover-content').hover(function() {
            $(this).find('div,a').stop(0,0).removeAttr('style');
            $(this).find('.hover-options').animate({opacity: 0.9}, 'fast');
            $(this).find('a').animate({"top": "15%" });
        }, function() {
            $(this).find('.hover-options').stop(0,0).animate({opacity: 0}, "fast");
            $(this).find('a').stop(0,0).animate({"top": "150%"}, "slow");
            $(this).find('a.zoom').stop(0,0).animate({"top": "150%"}, "slow");
        });
		}
		
		hover_effect();
		}
	
/*-------------------------------------------------------------*/
  /*			JQUERY PORTFOLIO HOVER  ENDS 		   		  */
  /*-------------------------------------------------------------*/		
 
 
 
 /*-------------------------------------------------------------*/
  /*			JQUERY HOMEPAGE CAROUSEL STARTS		   		  */
  /*-------------------------------------------------------------*/	
	(function() {

		var $carousel = $('#projects-carousel');

		if( $carousel.length ) {

			var scrollCount;

			if( $(window).width() < 480 ) {
				scrollCount = 1;
			} else if( $(window).width() < 768 ) {
				scrollCount = 1;
			} else if( $(window).width() < 960 ) {
				scrollCount = 3;
			} else {
				scrollCount = 4;
			}

			$carousel.jcarousel({
				animation : 600,
				easing    : 'easeOutCirc',
				scroll    : scrollCount
			});

		}

	})();

	 /*-------------------------------------------------------------*/
  /*			JQUERY HOMEPAGE CAROUSEL ENDS		   		  */
  /*-------------------------------------------------------------*/	

  
   /*-------------------------------------------------------------*/
  /*			JQUERY TWITTER FEEDS STARTS		   		  */
  /*-------------------------------------------------------------*/	
 if ( $( '.tweet' ).length && jQuery()) {
$(".tweet").tweet({
	 username: "trendywebstar", /* REMOVE "trendyWebStar" WITH YOUR OWN TWITTER USERNAME*/
	 join_text: null,
	 avatar_size: null,
	 count: 2,
	 auto_join_text_default: "we said,", 
	 auto_join_text_ed: "we",
	 auto_join_text_ing: "we were",
	 auto_join_text_reply: "we replied to",
	 auto_join_text_url: "we were checking out",
	 loading_text: "loading tweets..."
 });
 }
   /*-------------------------------------------------------------*/
  /*			JQUERY TWITTER FEEDS ENDS		   		  */
  /*-------------------------------------------------------------*/	
  
  
    /*-------------------------------------------------------------*/
  /*			JQUERY TIPSY STARTS	   							  */
  /*-------------------------------------------------------------*/	
if ( jQuery().tipsy ) {
	$("#filter-01").tipsy({gravity: 'n'});
	$("#filter-02").tipsy({gravity: 'n'});
	$("#filter-03").tipsy({gravity: 'n'});
	$("#filter-04").tipsy({gravity: 'n'});
	$("#filter-05").tipsy({gravity: 'n'});
	$("#filter-06").tipsy({gravity: 'n'});
	
	$("#social-01").tipsy({gravity: 'n',fade: true});
	$("#social-02").tipsy({gravity: 'n'});
	$("#social-03").tipsy({gravity: 'n'});
	$("#social-04").tipsy({gravity: 'n'});
	$("#social-05").tipsy({gravity: 'n'});
	$("#social-06").tipsy({gravity: 'n'});
	$("#social-07").tipsy({gravity: 'n'});
	$("#social-07").tipsy({gravity: 'n'});
	$("#social-08").tipsy({gravity: 'n'});
	$("#social-09").tipsy({gravity: 'n'});
	$("#social-10").tipsy({gravity: 'n'});
	$("#social-11").tipsy({gravity: 'n'});
	}
	
    /*-------------------------------------------------------------*/
  /*			JQUERY TIPSY ENDS	   							  */
  /*-------------------------------------------------------------*/	

    /*-------------------------------------------------------------*/
  /*			JQUERY FLEX SLIDER STARTS	   				   */
  /*-------------------------------------------------------------*/	  
   if ( $( '.flexslider' ).length && jQuery() ) {
	$('.flexslider').flexslider({ 
			animation: "fade",
			 controlNav:true,
			 controlsContainer:"#home",
			 directionNav: false,
			 slideshowSpeed: 7000,          
			animationDuration: 1000,
			 nextText:"&rsaquo;",
			  prevText:"&lsaquo;",
			 keyboardNav: true,  
			});
   }
    /*-------------------------------------------------------------*/
  /*			JQUERY FLEX SLIDER ENDS	   				   */
  /*-------------------------------------------------------------*/	 
/*-------------------------------------------------------------*/
  /*			JQUERY FLEX SLIDER  BLOG STARTS	   			   */
  /*-------------------------------------------------------------*/	    
    if ( $( '.blog-flexslider' ).length && jQuery() ) {
  
			$('.blog-flexslider').flexslider({ 
			 animation:"slide",
			 controlNav:false,
			 controlsContainer:"#home",
			 nextText:"&rsaquo;",
			  prevText:"&lsaquo;",
			 keyboardNav: false,  

			});
   }
	if ( $( '.blog-flexslider-small' ).length && jQuery() ) {
  
			$('.blog-flexslider-small').flexslider({ 
			 animation:"slide",
			 controlNav:false,
			 controlsContainer:"#home",
			 nextText:"&rsaquo;",
			  prevText:"&lsaquo;",
			 keyboardNav: false,  
  
			});
   } 
/*-------------------------------------------------------------*/
  /*			JQUERY FLEX SLIDER  BLOG ENDS	   			   */
  /*-------------------------------------------------------------*/	 

  
  
  /*-------------------------------------------------------------*/
  /*			JQUERY MAIN NAVIGATION STARTS 	  			   */
  /*-------------------------------------------------------------*/	
   if ( $( '#main-navigation' ).length && jQuery() ) {
var arrowimages={down:['downarrowclass', './images/plus-grey.png', 23], right:['rightarrowclass', './images/plus-grey.png']}
var jqueryslidemenu={
animateduration: {over: 200, out: 100}, //duration of slide in/ out animation, in milliseconds
buildmenu:function(menuid, arrowsvar){
	jQuery(document).ready(function($){
		var $mainmenu=$("#"+menuid+">ul")
		var $headers=$mainmenu.find("ul").parent()
		$headers.each(function(i){
			var $curobj=$(this)
			var $subul=$(this).find('ul:eq(0)')
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
			$curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: arrowsvar.down[2]} : {}).append(
				'<img src="'+ (this.istopheader? arrowsvar.down[1] : arrowsvar.right[1])
				+'" class="' + (this.istopheader? arrowsvar.down[0] : arrowsvar.right[0])
				+ '" style="border:0;" />'
			)
			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					this._offsets={left:$(this).offset().left, top:$(this).offset().top}
					var menuleft=this.istopheader? 0 : this._dimensions.w
					menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft
					if ($targetul.queue().length<=1) //if 1 or less queued animations
						$targetul.css({left:menuleft+"px", width:this._dimensions.subulw+'px'}).slideDown(jqueryslidemenu.animateduration.over)
				},
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					$targetul.slideUp(jqueryslidemenu.animateduration.out)
				}
			) //end hover
			$curobj.click(function(){
				$(this).children("ul:eq(0)").hide()
			})
		}) //end $headers.each()
		$mainmenu.find("ul").css({display:'none', visibility:'visible'})
	}) //end document.ready
}
}
jqueryslidemenu.buildmenu("main-navigation", arrowimages)

}

  /*-------------------------------------------------------------*/
  /*			JQUERY MAIN NAVIGATION ENDS 	  			   */
  /*-------------------------------------------------------------*/	

  
  
  
    /*-------------------------------------------------------------*/
  /*			JQUERY CONTACT FORM STARTS 			 			  */
  /*-------------------------------------------------------------*/	
    if ( $( '#contact-form' ).length && jQuery() ) {
$('form#contact-form').submit(function() {
function resetForm($form) {
    $form.find('input:text, input:password, input:file, select, textarea').val('');
    $form.find('input:radio, input:checkbox')
    .removeAttr('checked').removeAttr('selected');
}
$('form#contact-form .error').remove();
var hasError = false;
$('.requiredField').each(function() {
if(jQuery.trim($(this).val()) == '') {
 var labelText = $(this).prev('label').text();
 $(this).parent().append('<div class="error">You forgot to enter your '+labelText+'</div>');
 $(this).addClass('inputError');
 hasError = true;
 } else if($(this).hasClass('email')) {
 var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
 if(!emailReg.test(jQuery.trim($(this).val()))) {
 var labelText = $(this).prev('label').text();
 $(this).parent().append('<div class="error">You entered an invalid '+labelText+'</div>');
 $(this).addClass('inputError');
 hasError = true;
 }
 }
});
if(!hasError) {
$('form#contact-form input.submit').fadeOut('normal', function() {
$(this).parent().append('');
});
var formInput = $(this).serialize();
$.post($(this).attr('action'),formInput, function(data){
$('#contact-form').prepend('<div><span class="fancy-success">Your email was successfully sent. We will contact you as soon as possible.</span></div>');
resetForm($('#contact-form'));
$('.fancy-success').fadeOut(5000);
 
});
}
return false;
});
}
    /*-------------------------------------------------------------*/
  /*			JQUERY CONTACT FORM ENDS 			 			  */
  /*-------------------------------------------------------------*/	
  
    /*-------------------------------------------------------------*/
  /*		JQUERY PORTFOLIO ISOTOPE FILTER STARTS				  */
  /*-------------------------------------------------------------*/	
	(function() {
		var $container = $('.portfolio-items');
		if( $container.length ) {
			var $itemsFilter = $('#filterable');
			// Copy categories to item classes
			$('li', $container).each(function(i) {
				var $this = $(this);
				$this.addClass( $this.attr('data-categories') );
			});
			// Run Isotope when all images are fully loaded
			$(window).on('load', function() {
				$container.isotope({
					itemSelector : 'li',
					layoutMode   : 'fitRows'
				});
			});
			// Filter projects
			$itemsFilter.on('click', 'a', function(e) {
				var $this         = $(this),
					currentOption = $this.attr('data-categories');
				$itemsFilter.find('a').removeClass('active');
				$this.addClass('active');
				if( currentOption ) {
					if( currentOption !== '*' ) currentOption = currentOption.replace(currentOption, '.' + currentOption)
					$container.isotope({ filter : currentOption });
				}
				e.preventDefault();
			});
			$itemsFilter.find('a').first().addClass('active');			 
			$itemsFilter.on('mouseenter', function() {
				$(this).find('li a').stop(true,true).slideLeftShow(300);
			}).on('mouseleave', function() {
				$(this).find('li a').not('.active').stop(true,true).slideLeftHide(150);
			});

		}

	})();
    /*-------------------------------------------------------------*/
  /*		JQUERY PORTFOLIO ISOTOPE FILTER ENDS				  */
  /*-------------------------------------------------------------*/	
			});
			});
	     /*-------------------------------------------------------------*/
  /*		JQUERY ENDS		  */
  /*-------------------------------------------------------------*/