function mycarousel_initCallback(carousel) { // Disable autoscrolling if the user clicks the prev or next button. carousel.buttonNext.bind('click', function() { carousel.startAuto(0); }); carousel.buttonPrev.bind('click', function() { carousel.startAuto(0); }); // Pause autoscrolling if the user moves with the cursor over the clip. carousel.clip.hover(function() { carousel.stopAuto(); }, function() { carousel.startAuto(); }); }; $(window).load(function(){ /*Navigation*/ $('.nav>ul>li').each(function(){ var position=$(this).position() $('#sub-'+$(this).find('>a').attr('rel')).css({left:position.left,top:$('.nav').height()-13}); }) $('.nav').hover( function () {}, function () { //hide its submenu $('.sub-nav').slideUp(10); $('.nav>ul>li').removeClass('hover'); } ); $('.nav>ul>li').hover( function () { //hide its submenu $('.sub-nav').slideUp(10); $('.nav>ul>li').removeClass('hover'); //show its submenu $('#sub-'+$(this).find('>a').attr('rel')).slideDown(10); $(this).addClass('hover'); }, function () { } ); $('.sub-nav li').hover( function () { //show its submenu $('>.sub-nav', this).slideDown(10); $(this).addClass('hover'); }, function () { //hide its submenu $('>.sub-nav', this).slideUp(10); $(this).removeClass('hover'); } ); if($('#carousel li').length>4){ /* $('#carousel').jcarousel({ size: 4, scroll: 1, wrap: 'circular' })*/ $('#carousel-clip').jCarouselLite({ scroll : 1, visible: 4, btnNext: '.next', btnPrev: '.prev' }); $('#carousel-clip').parent().find('.next').show(); $('#carousel-clip').parent().find('.prev').show(); } function mycarousel_initCallback(carousel) { // Disable autoscrolling if the user clicks the prev or next button. carousel.buttonNext.bind('click', function() { carousel.startAuto(0); }); carousel.buttonPrev.bind('click', function() { carousel.startAuto(0); }); // Pause autoscrolling if the user moves with the cursor over the clip. carousel.clip.hover(function() { carousel.stopAuto(); }, function() { carousel.startAuto(); }); }; if($('#company-carousel li').length>3){ $('#carousel-clip').jCarouselLite({ scroll : 1, visible: 3, btnNext: '.next', btnPrev: '.prev' }); $('#carousel-clip').parent().find('.next').show(); $('#carousel-clip').parent().find('.prev').show(); } $('.carousel-wrap').css({'visibility':'visible'}) liAlign(".s-detail-2") liAlign("ul.portfolio") }) function liAlign(ul){ $(ul).find(">li:nth-child(3n-2)").each(function(){ var height=$(this).height(); if($(this).next().length){ height=$(this).next().height()>height?$(this).next().height():height; } if($(this).next().next().length){ height=$(this).next().next().height()>height?$(this).next().next().height():height; } if (height!=0){ $(this).height(height) $(this).next().height(height) $(this).next().next().height(height) } }) } $(document).ready(function(){ $('.top-title').prepend('
'); function onAfter(curr, next, opts, fwd) { var $ht = $(next).height()>$(curr).height()?$(next).height():$(curr).height(); //set the container's height to that of the current slide $(this).parent().css({height: $ht}); } if($('.post-carousel li').length>1){ $('.post-carousel').cycle({ fx: 'scrollLeft', timeout: 6000, next: '#next2', prev: '#prev2', before: onAfter }); } if($('.letter .f-carousel li').length>1){ $('.letter .f-carousel').cycle({ fx: 'scrollLeft', timeout: 16500, next: '#next', prev: '#prev', before: onAfter }); } //ie7 hack if($('html').hasClass('ie7')){ $(".nav>ul>li, .rel-posts li:first, .rel-posts li:last, .f-widget .img-container, .f-post h2, .f-letter, .portfolio li:nth-child(6n-3), .portfolio li:nth-child(6n-2),.s-detail>li:nth-child(2n-1),.s-detail>li:nth-child(2n),.s-detail>li:nth-child(3),.s-detail>li:nth-child(1),.s-detail-2 li ul li").prepend(''); $(".f-post h2").append(''); } /*About hover effect*/ $('.team-container, .about-pic').hover(function(){ $(this).find('img:first').fadeOut(200); $(this).find('img.hover').fadeIn(200); }, function(){ $(this).find('img:first').fadeIn(200); $(this).find('img.hover').fadeOut(200); }) //Home Slider var startIndex=0; var current=startIndex; var total=$("#slides>img").length var slider=$("#slides").slides({ navigation: false, effects: { navigation: "fade", pagination: "fade" }, width:792, height:406, playInterval: 8000, startAtSlide: startIndex, navigateStart: function() { var curSlider=$('.slides-text').find('#slide-'+current); $('.active-slide',$('.slides-text')).fadeOut(function(){ $(this).removeClass('active-slide'); $('.slides-text').animate({height:curSlider.height()},{'complete':function(){ curSlider.fadeIn(); }}); }); curSlider.addClass('active-slide'); current=(current==(total-1))?0:parseInt(current)+1 } }) slider.slides("play"); $('.slidesPagination li a').click(function(){ if(!$(this).parent().hasClass('slidesCurrent')){ current=$(this).attr('data-slidesindex'); } else return false; }) /*Portfolio slider*/ // assign the slider to a variable var slider = $('#potfolio-slider .sliderContainer').bxSlider({ controls: false, mode: 'fade', auto: true, speed: 1000, pause: 5000 }); // assign a click event to the external thumbnails $('#carousel li').live('click',function(event){ event.preventDefault(); var thumbIndex = parseInt($(this).find('a').attr('rel')); // call the "goToSlide" public function slider.goToSlide(thumbIndex); // remove all active classes $('#potfolio-slider #carousel li').removeClass('pager-active'); // assisgn "pager-active" to clicked thumb $(this).addClass('pager-active'); // very important! you must kill the links default behavior return false; }); // assign "pager-active" class to the first thumb $('#potfolio-slider #carousel li:first').addClass('pager-active'); $('#cart input[type="submit"]').live('click',function(){ $.cookie("array_item", null,{path: '/' }); }) /*Colorbox*/ $(".cart, .add-btn,.basket").colorbox({ width:"844px", opacity: 0.65, onComplete:function(){ Cufon.set('fontFamily', 'Sheila').replace('.cart-h h2'); $('.clear-input').clearInput(); } }); $('.sb-widget #searchform input[type="text"]').val('Search'); }); /* jQuery Clear-Input plugin v1.0 Author: Aidan Feldman USAGE Add the class .clear-input to any text input element whose value you want cleared when it gains focus. The initial value will be replaced when the input loses focus, and no new text has been entered. If you prefer to not add classes to your elements, you can alternatively call clearInput() on any jQuery input object. */ (function( $ ){ // define the initialValue() function $.fn.initialValue = function(value) { if (value) { return this.attr('initial-value', value); } else { return this.attr('initial-value'); } }; $.fn.clearInput = function() { if(this.val()){ return this .focus(function(){ if (this.value == $(this).initialValue()) { this.value = ''; } }) .blur(function(){ if (this.value == '') { this.value = $(this).initialValue(); } }) .each(function(index, elt) { $(this).initialValue(this.value); }); } }; // apply plugin to all inputs with class ".clear-input" $(function() { $('input[type="text"]').clearInput(); $('textarea').clearInput(); }); })( jQuery );