• Dave’s plugin was generating a JS error when resizing the browser window, saying it couldn’t get the .left property of the hidden search field. This error was preventing my other code from executing when the user resizes the window.

    When browsing to the forums, I found an old fix for the search results reappearing when the user resizes the window. This has been fixed by setting and checking the wasVisible variable in daves-wordpress-live-search.js.

    I’ve modified the code so the positioning function only fires when the search field is visible:

    OLD

    LiveSearch.positionResults(this);
    // Resizing the window was making the results visible again
    if(!wasVisible) {
            LiveSearch.resultsElement.hide();
    }

    NEW

    // Resizing the window was making the results visible again
    if(!wasVisible) {
    	LiveSearch.resultsElement.hide();
    } else {
    	LiveSearch.positionResults(this);
    }

    Everything is working smoothly now. Maybe this helps someone who has the same problem, or maybe it’s just limited to my setup.

  • The topic ‘[Plugin: Dave's WordPress Live Search] Generating error on window resize’ is closed to new replies.