Sauter la navigation

[Résolu] Split: How to stop pagination controls from scrolling with the results

This support ticket is created Il y a 4 années et 6 mois. 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.

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

Supporter timezone: Asia/Karachi (GMT+05:00)

Ce sujet contient 5 réponses, a 2 voix.

Dernière mise à jour par Jaime Il y a 4 années et 6 mois.

Assisté par: Waqar.

Auteur
Publications
#1648499

Hi Waqar!
Thanks for your answer!
🙂

It has resolved my problem almost perfectly (with a simple issue of scrolling which i'll investigate further later).
So, thank you very much.

Anyway I have another issue I would like to comment with you about paginations.
In my website I need to have some ajax pagination with horizontal scrolling.
The problem is the pagination only works fine when the pagination shortcode is inside the layout (I mean, before [wpv-layout-end]).
When I insert it after [wpv-layout-end] the pagination seems to get stucked in the same results infinite.

I've prepared you a page with two paginations (one outside and another inside) to see it in action. (go below, with red fonts)
lien caché

You can see it also here (in the pagination with film posters with the "next" "before" pagination items.
lien caché

Do you have any clue of what is teh problem with the pagination and the [wpv-layout-end]?
For me the major problem is UX because it's not a usual behavior the pagination controls slides with the results. The rest is ok.

Thanks a lot Waqar for your time and knowledge!
🙂

#1648509

My issue is resolved now. Thank you!

#1648511

Sorry I marked this ticket as resolved by error.

#1648521

Hi,

Thanks for asking! I'd be happy to help.

Your observation is correct and when a view is set to update paginated results through AJAX, only the content placed between the "[wpv-layout-start]" and "[wpv-layout-end]" tags, is updated when AJAX executes.

For this reason, if the pagination's code is placed outside those tags, they don't update correctly with each AJAX execution.

To overcome this limitation, you can follow this workaround:

1. You can include the pagination code in a special div container with a class "original-pagination", just before the "[wpv-layout-end]" tag.
( screenshot: lien caché )

Example:


<div class="original-pagination">
<ul class="pagination">
	<li class="page-item">[wpv-pager-prev-page force="true"][wpml-string context="wpv-views"]Previous[/wpml-string][/wpv-pager-prev-page]</li>
	<li class="page-item">[wpv-pager-next-page force="true"][wpml-string context="wpv-views"]Next[/wpml-string][/wpv-pager-next-page]</li>
</ul>
</div>

2. Next, you can add an empty div container for the pagination's copy, with class "shadow-pagination", just after the "[wpv-layout-end]" tag.
( screenshot: lien caché )


<div class="shadow-pagination"></div>

3. Using some custom CSS code, you can hide the div which holds the actual pagination.
( screenshot: lien caché )


div.original-pagination {
display: none;
}

4. And using some custom JS code, you can move the content from the up-to-date pagination into the shadow copy container:


// function to copy pagination's content from one div to another
function updatePagination() {
	jQuery('.shadow-pagination').html('');
	jQuery('.original-pagination').contents().appendTo('.shadow-pagination')
}

// execute the updatePagination function on page load and pagination update through AJAX
jQuery( document ).on( 'js_event_wpv_pagination_completed ready', function( event, data ) {
	updatePagination();
});

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1648557

Hi Waqar. My issue is resolved, but I can't close the ticket.
It says ERROR: Duplicate reply detected; it looks as though you’ve already said that!

You can marked this as resolved and VERY HAPPY WITH THE SUPPORT RECEIVED BY WAQAR.
🙂

#1648559

My issue is resolved now.
Thank you!