• Resolved tonton_mtl

    (@tonton_mtl)


    The problem appends with my theme which uses a JS function to calculate the height of the page and adjust other elements to display them properly. Because of the job list preloader, my theme calculate the wrong height and the job list goes under my footer.

    So, I’m trying to trigger the ‘resize’ fonction of my theme with JQuery when the jobs are loaded.

    I’ve been able to do that with some changes in the output_jobs function, now is there a way to do that without changing the plugin files ?

    https://www.ads-software.com/plugins/wp-job-manager/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    I’m surprised themes still do this. Could you perhaps use this? https://api.jquery.com/ajaxcomplete/ Then you could trigger your resize whenever that fires.

    Thread Starter tonton_mtl

    (@tonton_mtl)

    Thank you Mike!

    My previous working JS code was :
    <script>// <![CDATA[ setTimeout(function(){ jQuery(window).trigger("resize");}, 2500); // ]]></script>

    I tried :
    <script>// <![CDATA[ jQuery(document).ajaxComplete(function() {alert('Ajax')} // ]]></script>

    I also tried to put this function in a

    jQuery(document).ready(function() {…}

    But the ajaxComplete never trigger the Alert…

    Are you sure you load the events with Ajax ?

    When I comment the

    ob_start();

    in the output_jobs function I don’t have the page layout problem…

    So I’m not sure if the content is Ajax loaded or output buffered ?

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    The content of [jobs] is loaded via ajax if filters is enabled. Are they?

    Thread Starter tonton_mtl

    (@tonton_mtl)

    The [jobs] shortcode is working so I presume filters is enabled on my theme, right ?

    Here is the page where I do a resize after 2.5 seconds to shows the jobs properly : https://staging.grandtoronto.ca/offres-demploi/

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Try a settimeout as well after ajax – it still needs to render the list so there may be a little delay after the ajax event.

    My honest opinion however, look at styling your site/modifying the theme to remove the need for your JS height function. I see no reason why you cannot just have a clear fix at the bottom and let the content grow naturally. The height calculation function you have is inefficient and surely must cause issues for more than just this plugin.

    Thread Starter tonton_mtl

    (@tonton_mtl)

    Now it works!

    Here is the working code :

    <script>// <![CDATA[ jQuery( document ).ajaxComplete(function() { jQuery(window).trigger("resize");}); // ]]></script>

    I write this, just after the [jobs] shortcode in the page text tab.

    It didn’t work with the code on different lines but now it works with everything on the same line…
    Also, notice that I had to use jQuery( document ) because $( document ) was not working…

    Hope it could help other people have the same problem in the future and thanks a lot Mike for you patience!!!

    J.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Force resize window when job list loaded’ is closed to new replies.