HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ns3133907 6.8.0-86-generic #87-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 22 18:03:36 UTC 2025 x86_64
User: cssnetorguk (1024)
PHP: 8.2.28
Disabled: NONE
Upload Files
File: //home/design-blogs.co.uk/public_html/wp-content/themes/newscrunch/assets/js/main.js
(function($){
  
    $(document).ready(function() {
    
        // Fullwidth Serach Box
        $(function(){
            var $searchlink = $('#search_toggle_fullwidth');
            var $searchbar_fullwidth  = $('#searchbar_fullwidth');
          
            $('#search_toggle_fullwidth').on('click', function(e){
              e.preventDefault();
                if($(this).attr('id') == 'search_toggle_fullwidth') {
                    if(!$searchbar_fullwidth.is(":visible")) { 
                        // if invisible we switch the icon to appear collapsable
                        $searchlink.removeClass('fa-search').addClass('fa-search-minus');
                    } else {
                        // if visible we switch the icon to appear as a toggle
                        $searchlink.removeClass('fa-search-minus').addClass('fa-search');
                    }
                    $searchbar_fullwidth.slideToggle(300, function(){
                    // callback after search bar animation
                    });
                }
            });
          
          $('#searchform_fullwidth').submit(function(e){
              e.preventDefault(); // stop form submission
          });
        });


        // Fullscreen Serach Box 
        $(function() {      
            $('a[href="#searchbar_fullscreen"]').on("click", function(event) {    
                event.preventDefault();
                $("#searchbar_fullscreen").addClass("open");
                $('#searchbar_fullscreen > form > input[type="search"]').focus();
            });

            $("#searchbar_fullscreen, #searchbar_fullscreen button.close").on("click", function(event) {
                if (
                  event.target == this ||
                  event.target.className == "close" ||
                  event.keyCode == 27
                ) {
                    $(this).removeClass("open");
                }
            });
 
        });

    });
})(jQuery);