$(document).ready(function(){ $("a[rel='lb']").colorbox({}); }); $(document).ready(function(){ $(".colorbox").colorbox({}); }); $(document).ready(function(){ $('#ei-slider').fixGallery(); $('#ei-slider').eislideshow({ animation : 'center', autoplay : true, slideshow_interval : 10000, titlesFactor : 0 }); }); //******* Breda Mobile Menu ***********// (function($){ $(function(){ $('#menu').prepend(''); //Create div for Menu Icon $("#menu-icon").click(function(){ //Show #nav on click $("#nav").slideToggle('fast'); $(this).toggleClass("active"); }); }); })(jQuery); //******** End of Breda Mobile Menu *******// //*********Breda Pest Gallery Search Function********// (function($){ /************************ Name: livePageSearch(); Author: Matthew Peach Requires: jQuery 1.7 Usage example: $('#search-field').livePageSearch({ searchItems: '.itemTitle', displayType: 'fade', displaySpeed: 'slow', noResultsText: 'Opps, We could not find that word.' }); ************************/ jQuery.fn.livePageSearch = function(options){ //defaults var defaults = { searchItems: null, // (REQUIRED) The selector to search through. displayType: 'fade', // 'fade' or 'show' displaySpeed: '', // 'fast' or 'slow' Used for the fade speed. noResultsText: 'No Search Results Found.' //Text to display if no search results found. } //Combine specified options with defaults. var options = $.extend(defaults, options); //Check to make sure a selector to search through was specified. if(options.searchItems == null){ return false; } //Set the method of showing and hiding the matching items. if(options.displayType == 'fade'){ var animateIn = function(obj,speed){ obj.fadeIn(speed); }; var animateOut = function(obj,speed){ obj.fadeOut(speed); }; }else{ var animateIn = function(obj){ obj.show(); }; var animateOut = function(obj){ obj.hide(); }; } //Begin livePageSearch function on the search fields specified. return this.each(function(){ var o = options; var obj = $(this); //Add a paragraph element containing the text to display if no search results were //found to the end of the parent container holding the items that will be searched through. $(o.searchItems).parent().append(''); //Run the findItems function each time the value is changed in the search field. obj.keyup(function(){ var searchTerm = obj.attr('value'); //Get the value of the search field. findItems(searchTerm); }); function findItems(searchTerm){ var resultsCount = 0; $(o.searchItems).each(function(){ var itemValue = $(this).html(); //Get the inner html of the searchItems to compare. var regex = '(' + searchTerm + ')'; //Create the RegEx pattern. var pattern = new RegExp(regex,'i'); var result = pattern.test(itemValue); //Compare the inner html with the searchTerm if(result){ //If RegExp is true, show the item and increase the results Count by 1. animateIn($(this),o.displaySpeed); ++resultsCount; $('.no-results-text').hide(); }else{ //If RegExp is false, hide the item animateOut($(this),o.displaySpeed); } }); //Check to see if there where no results for the search. If so, display the text for no results. if(resultsCount == 0){ animateIn($('.no-results-text'),o.displaySpeed); } } }); }; })(jQuery); $(function(){ $('#pest-gallery-search').livePageSearch({ searchItems:'.subpageitem', noResultsText: "Sorry, we can't find that Pest in our gallery." }); }); //********* social links in new window **********// $('.social a').each(function() { var a = new RegExp('/' + window.location.host + '/'); if(!a.test(this.href)) { $(this).click(function(event) { event.preventDefault(); event.stopPropagation(); window.open(this.href, '_blank'); }); } });