/*plugins*/ /** * hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+ * * * @param f onMouseOver function || An object with configuration options * @param g onMouseOut function || Nothing (use configuration options object) * @author Brian Cherne brian(at)cherne(dot)net */ (function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY)) '); $('.sub-menu').parent().addClass('has-sub-menu'); //add a seperator $('#menu-header-menu > li').not('#menu-header-menu > li:last').after(' / '); //remove existing margin-right $('#menu-header-menu > li').not('#menu-header-menu > li:last').css("margin-right", 3) var navConfig = { over : doOpen, // function = onMouseOver callback (REQUIRED) timeout : 300, // number = milliseconds delay before onMouseOut out : doClose // function = onMouseOut callback (REQUIRED) }; function doOpen() { // alert("over"); // $('ul:first',this).css('visibility', 'visible'); $('ul:first', this).slideDown(200); $(this).addClass("hover-over"); } function doClose() { //$('ul:first',this).css('visibility', 'hidden'); $('ul:first', this).hide(); $(this).removeClass("hover-over"); } $('.sub-menu').parent().hoverIntent(navConfig); $('#menu-header-menu > li.current-menu-item, #menu-header-menu > li.current-menu-parent, #menu-header-menu > li.current-page-ancestor').append(''); $('#menu-header-menu > li.current-menu-item img').width($('#menu-header-menu > li.current-menu-item').width()+12); $('#menu-header-menu > li.current-menu-parent img').width($('#menu-header-menu > li.current-menu-parent').width()+12); $('#menu-header-menu > li.current-page-ancestor img').width($('#menu-header-menu > li.current-page-ancestor').width()+12); // Match height of set of elements with the specified class $.fn.equalHeight = function() { tallest = 0; this.each(function() { thisHeight = $(this).height(); if(thisHeight > tallest) tallest = thisHeight; }); // set each items height to use the tallest value found this.each(function() { $(this).height(tallest); }); } // Homepage slider var sliderHomeA = $('#slides').bxSlider({ auto : true, controls : false, speed : 1000, pause : 8000, pager: true, pagerSelector : '#slideshow-tabs', buildPager: function(slideIndex){ switch (slideIndex){ case 0: return 'New! Tilda KidsOur unique kids range'; case 1: return 'Mums Helping MumsHelping 1000s of mums every day'; case 2: // return 'Rice & ExerciseImprove your wellbeing'; return 'Tilda, Legendary RiceThe story of Tilda'; case 3: return 'Win Big!Bag Millions in cash prizes!'; case 4: return 'Tilda FoodserviceTrusted by chefs since 1994'; } } }); var sliderHomeB = $('#slide-bgs').bxSlider({ auto : true, mode : 'fade', controls : false, wrapperClass : 'my-bg-wrapper', speed : 1000, pause : 8000 }); $('.home #media-panel .prev').click(function() { sliderHomeA.goToPreviousSlide(); sliderHomeB.goToPreviousSlide(); return false; }); $('.home #media-panel .next').click(function() { sliderHomeA.goToNextSlide(); sliderHomeB.goToNextSlide(); return false; }); // assign a click event to the external HOME slider tabs $('.home #slideshow-tabs a').click(function() { var thumbIndex = $('#slideshow-tabs a').index(this); sliderHomeB.goToSlide(thumbIndex); // remove all active classes $('#slideshow-tabs li').removeClass('pager-active'); // very important! you must kill the links default behavior var myActiveSlide = thumbIndex + 1 $('#slideshow-tabs li:nth-child(' + myActiveSlide + ')').addClass('pager-active'); return false; }); // Food Services slider var sliderTradeA = $('#slides-trade').bxSlider({ auto : true, controls : false, speed : 1000, pause : 8000, pager: true, pagerSelector : '#slideshow-tabs', buildPager: function(slideIndex){ switch (slideIndex){ case 0: return 'Tilda FoodserviceTrusted by chefs since 1994'; case 1: return 'Rice Matters on the RoadDiscover why top chefs trust Tilda'; case 2: return 'Recipe InspirationMouth-watering rice dishes to suit any menu'; } } }); var sliderTradeB = $('#slide-bgs-trade').bxSlider({ auto : true, mode : 'fade', controls : false, wrapperClass : 'my-bg-wrapper', speed : 1000, pause : 8000 }); $('.page-template-page-trade-php #media-panel .prev').click(function() { sliderTradeA.goToPreviousSlide(); sliderTradeB.goToPreviousSlide(); return false; }); $('.page-template-page-trade-php #media-panel .next').click(function() { sliderTradeA.goToNextSlide(); sliderTradeB.goToNextSlide(); return false; }); // assign a click event to the external TRADE slider tabs $('.page-template-page-trade-php #slideshow-tabs a').click(function() { var thumbIndex = $('#slideshow-tabs a').index(this); sliderTradeB.goToSlide(thumbIndex); // remove all active classes $('#slideshow-tabs li').removeClass('pager-active'); // very important! you must kill the links default behavior var myActiveSlide = thumbIndex + 1 $('#slideshow-tabs li:nth-child(' + myActiveSlide + ')').addClass('pager-active'); return false; }); //common slider witdth settings $('.my-bg-wrapper, .my-bg-wrapper .bx-window').width("100%"); //add a grey border to the right of all but the last tab $('#slideshow-tabs a').not('#slideshow-tabs a:last').css("border-right","1px solid #999") if ($('#slideshow-tabs').length) { //add a drop shadow under the tabs var tabShadowPosition = $("#slideshow-tabs a:first").position(); $('#slideshow-tabs').append(''); } /*add a class onto the first and last tabs, to add slight rounded corners via css*/ $("#slideshow-tabs a:first").addClass("slideshowTab-first") $("#slideshow-tabs a:last").addClass("slideshowTab-last") /*add shadows to ALL panels*/ $('.panel').append(''); $('#sidebar .panel').css("bottom","-12px") $('.panel').css("overflow","visible") /*add a class to the first paragraphs of some pages*/ if ($('.post-content article').length) { $('.post-content article p:first').addClass("intro-paragraph"); /*kill this new formatting on Archive and Search pages etc*/ $('.archive .post-content article p:first').removeClass("intro-paragraph"); $('.search .post-content article p:first').removeClass("intro-paragraph"); $('.page-id-2074 .post-content article p:first').removeClass("intro-paragraph"); $('.page-id-96 .post-content article p:first').removeClass("intro-paragraph"); $('.page-id-100 .post-content article p:first').removeClass("intro-paragraph"); } /*remove top margin off first

or

in content area*/ // Home section product slider $('.product-slider #public-products-list').bxSlider({ auto: false, autoControls: false, controls: true, speed: 1000, pause: 8000, pager: false, displaySlideQty: 5 }); // Catering section product slider $('.product-slider #catering-products-list').bxSlider({ auto: false, autoControls: false, controls: true, speed: 1000, pause: 8000, pager: false, displaySlideQty: 3 }); // Kids section product slider $('.product-slider #kids-products-list').bxSlider({ auto: false, autoControls: false, controls: true, speed: 1000, pause: 8000, pager: false, displaySlideQty: 4 }); // Trade recipes product slider $('.product-slider #trade-recipe-list').bxSlider({ auto: false, autoControls: false, controls: true, speed: 1000, pause: 8000, pager: false, displaySlideQty: 3, moveSlideQty: 3 }); // Single product page slider $('.product-slider #sibling-products-list').bxSlider({ auto: false, autoControls: false, controls: true, speed: 1000, pause: 8000, pager: false, displaySlideQty: 5 }); $('#latestnews-set').bxSlider({ mode: 'fade', auto: true, autoControls: false, controls: true, speed: 1000, pause: 8000, pager: false }); $('#facts-slider').bxSlider({ mode: 'horizontal', auto: true, autoControls: false, controls: true, speed: 1000, pause: 10000, pager: false }); $('#featuredrecipe-slider').bxSlider({ mode: 'fade', auto: true, autoControls: false, controls: true, speed: 1000, pause: 6000, pager: false }); $('#latestnews-set .item-inner').wrap('
'); // Animate products in a slider on hover $("#public-products .picture").hover(function() { $(this).stop().animate({ marginTop: "-6px" }, 200); $(this).parent().find("span").stop().animate({ marginTop: "18px", opacity: 0.25 }, 200); },function(){ $(this).stop().animate({ marginTop: "0px" }, 300); $(this).parent().find("span").stop().animate({ marginTop: "1px", opacity: 1 }, 300); }); // Match heights of elements with each other $('#distributors-content .distributor').equalHeight(); // Fancy hovers for box selectors /* $(".fancy-ov").hover(function(e) { $(this).animate({opacity:1.0},400); },function(e) { $(this).animate({opacity:0.5},400); }); */ // Make entire panel clickable $(".panel-set .panel:has(a)").click(function() { if ($('.panel-set #panel-newsletter').length) { } else { window.location = $("a:first",this).attr("href"); } }); $("#page-panel-nav .panel:has(a)").click(function() { window.location = $("a:first",this).attr("href"); }); // Public product slider clickable products $(".product-slider .product:has(a)").click(function() { window.location = $("a:first",this).attr("href"); }); // Latest news panel clickable items $("#panel-latestnews .item:has(a)").click(function() { window.location = $("a:first",this).attr("href"); }); // Make entire panel clickable $("#panel-wfp-story").css("cursor","pointer") $("#panel-wfp-story:has(a)").click(function() { window.location = $("a:first",this).attr("href"); }); // Make entire panel clickable $("#panel-wfp-find-out-more").css("cursor","pointer") $("#panel-wfp-find-out-more:has(a)").click(function() { window.location = $("a:first",this).attr("href"); }); $("#panel-wfp-find-out-more a").hide() $(".gform_wrapper li").addClass("clearfix") // $(".panel-set .product-cat .product-content").css("left", 0).hide() $(".panel-set .product-cat").hover(function() { $(this).find(".product-content:first").stop(true, true).fadeIn('fast') }, function() { $(this).find(".product-content:first").stop(true, true).slideUp('fast') }); //logo hover animation $('#tilda-logo').hover(function() { $('#tilda-logo').animate({ top : '-5' }, 150); }, function() { $('#tilda-logo').animate({ top : '-10' }, 75); }); //logo hover animation $('#where-to-buy li').hover(function() { $(this).find("img:first").animate({ top : '-5' }, 150); }, function() { $(this).find("img:first").animate({ top : '0' }, 75); }); //mums helping mums page stuff $('#mums2mums-totaliser li').wrapInner('') // Split the faq list $('#faq-items .item:nth-child(odd)').addClass('clear'); // Image border niceness $.fn.imageBorders = function() { var imgClass = $(this).attr('class'); $(this).wrap('
'); $(this).wrap(''); $(this).removeAttr('class'); } $('.page-template-default .post-content img.wp-post-image').imageBorders(); $('.single-recipe .recipe-press-image img.wp-post-image').imageBorders(); $('.single-post article img.wp-post-image').imageBorders(); }); $(window).load(function() { }); })(jQuery);