Skip Navigation

[Resolved] Infinite scrolling

This support ticket is created 3 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 5.81 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Lara 3 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#2050929

Tell us what you are trying to do?

I use infinite scrolling together with a third party plugin "HideYT", with which related YouTube videos and other YouTube stuff (e.g. video titel) can be hidden. The third party plugin helps to achieve the same goals, that could be achieved through rel=0 and showinfo=0 in the past.

Recently the plugin switched from this code:
hidden link

to this code:
hidden link

With the new code (hidden link) there is the issue, that as soon as the infinite scrolling kicks in the YouTube videos from the "previous" page disappear and there is a white space instead. I investigated the problem together wíth the plugin creator and that is what he figured out:

------------------------

"As far as where the issue is in the code, it's not really as much an issue with specific lines of the code as it is with the way the whole script is designed to only be run once, then expects the iframes to stay in place after everything is set up (the infinite scroll plugin that you have installed clears out the iframes, removing the HideYT code from them). The main entry point of the application logic is in the "updatePlayers" function, which is called periodically on a timer to detect and convert new YouTube iframes to HideYT iframes using the "initPlayer" function. The HideYT code converts the YouTube iframe into its own HideYT iframe that has the YouTube iframe nested one layer deeper. You can see the nested iframes in a web browser's element inspector.

Regards,
-Max"

------------------------

He says he can't do anything about it.

Is there a way with which I can prevent, that the Toolset infinite scrolling clears out the iframe?

Is there any documentation that you are following?
https://toolset.com/documentation/legacy-features/views-plugin/infinite-scrolling-in-views/

Is there a similar example that we can see?
no

What is the link to your site?
hidden link

#2050977

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Lara,

Thank you for getting in touch. I suspect that this is occurring because the plugin you are using is dynamically adding the iframes using Javascript.

If that is the case whenever the AJAX pagination triggers then the id's of the posts being displayed are changed because the data is being dynamically loaded.

In a case like this we will need a callback function to trigger the code in the plugin again. If the Author has written a function that can be called back then you can add it in the Callback function below and trigger your code again.

jQuery( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
	/**
	* data.view_unique_id (string) The View unique ID hash
	* data.effect (string) The View AJAX pagination effect
	* data.speed (integer) The View AJAX pagination speed in miliseconds
	* data.layout (object) The jQuery object for the View layout wrapper
	*/
	
});

Please let me know if this helps.
Thanks,
Shane

#2051015

Many thanks for your answer, Shane.

Unfortunately most of the HideYT code is designed to only run once, when the page is initially loaded, so it would require a rewrite of large parts of HideYT to be able to integrate a JavaScript callback like that. Currently the plugin creator is not interested to rewrite the code and integrate the JavaScript callback. He offered me a refund instead.

The interesting thing is, that the problem only occurs on the "so to speak previous page", whereas the newly loaded posts are not affected..

If you think, that there is no other option than using a callback, then I will accept, that that's a dead end at the moment 😉

Thanks again for your suggestion Shane 🙂

#2051071

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Lara,

Thats not welcoming news at all. Unfortunately the only other workaround I can think of is to not use AJAX pagination which in your case may not be an option.

I would recommend the developer rethink this approach as it would mean that AJAX pagination from any plugin may end up breaking the functionality as it did here.

At this point not much we can do here from our side.

Thanks,
Shane

#2051715

Hi Shane,

yes I agree with you, that it would be lovely, if the developer would rethink his approach.

For now I think I will implement the legacy code (hidden link) of the plugin, as it wasn't an issue there.

Thanks again Shane 🙂