Tagged: ajax, hidden content, tab section
-
AuthorPosts
-
July 12, 2020 at 10:25 pm #1229800
Hi,
My problem concerns tab section. Here is an example: http://www.sensity.pl/umow-spotkanie-online/rezerwowa/.I placed dynamic booking form to the first tab. I set auto adjusting height to content because in the second tab I placed another very high form.
Unfortunately the dynamic booking form on the first tab becomes cut: https://snipboard.io/uar1ho.jpg.
It think the auto height is adopted to login widget on the right. It is even easier to see when you choose any values from both dropdown menus and go forward clicking “dalej” (next). On the second step you can see that a calendar is hidden: https://snipboard.io/aVieNM.jpgHere is how is should work: https://www.sensity.pl/umow-spotkanie-online/ (works fine because I took booking form above from tab section).
Is there any way to make it work in the tab?July 15, 2020 at 12:53 pm #1230586Hey kwlodar,
Thank you for the update.
We might be able to force the tab section to resize after clicking on the next or previous button in the forms, but we have to access the site first and check it further. The script might look something like this:
(function($) { $('.bookly-box button').on('click', function() { var tab = $(this).parents('.av-layout-tab'); var id = tab.data('av-tab-section-content'); $('.av-section-tab-title[data-av-tab-section-title="' + id + '"]').trigger('click'); }) })(jQuery);
Best regards,
IsmaelJuly 15, 2020 at 7:17 pm #1230703OK, let’s try. Do you need a temporary admin access to my site?
Regards!
ChrisJuly 17, 2020 at 7:26 am #1231114Hi Chris,
Yes, we do. Please post admin login details in private.
Best regards,
RikardJuly 17, 2020 at 9:33 am #1231142Thank you! Login link attached.
One note: pages mentioned above are just an examples. I’d like to have this dynamic resize working on each tab selection element, so I have place booking form this way anywhere in the service.
I’d like to ask you also to let me know what you did when you finish. I don’t use child them (shame on me! I know…) and I transfer some settings from functions.php between versions. I need to know if I have to transfer anything else.
Regards!
July 20, 2020 at 7:39 am #1231634Hi,
Thank you for the update.
The form button sends an AJAX request when clicked, so we can wait for that request and reset the height of the tab section afterwards. We tried to add the script in the functions.php via Appearance > Editor panel but we always get an SFTP error or notice. We may need to access the file server directly.
If you want to test it yourself, just add this code in the functions.php file.
add_action("wp_footer", "ava_bookly_resizer", 9999); function ava_bookly_resizer() { ?> <script> (function($) { var s_ajaxListener = new Object(); s_ajaxListener.tempOpen = XMLHttpRequest.prototype.open; s_ajaxListener.tempSend = XMLHttpRequest.prototype.send; s_ajaxListener.callback = function () { setTimeout(function() { $(window).trigger('debouncedresize av-content-el-height-changed'); }, 500); } XMLHttpRequest.prototype.open = function(a,b) { if (!a) var a=''; if (!b) var b=''; s_ajaxListener.tempOpen.apply(this, arguments); s_ajaxListener.method = a; s_ajaxListener.url = b; if (a.toLowerCase() == 'get') { s_ajaxListener.data = b.split('?'); s_ajaxListener.data = s_ajaxListener.data[1]; } } XMLHttpRequest.prototype.send = function(a,b) { if (!a) var a=''; if (!b) var b=''; s_ajaxListener.tempSend.apply(this, arguments); if(s_ajaxListener.method.toLowerCase() == 'post')s_ajaxListener.data = a; s_ajaxListener.callback(); } })(jQuery); </script> <?php }
Or post the SFTP details in the private field so that we can test the modification.
Source: https://gist.github.com/alecperkins/3889507
Best regards,
IsmaelMarch 30, 2021 at 9:09 pm #1291454Sorry for it took so long…
I’ve implemented the code you suggested in functions.php, but it seems not working. :(
I’ve created another test site: https://www.sensity.pl/bookly-test-site/1. First tab loads too low even on the beginning: https://snipboard.io/IC09s3.jpg.
2. After switching to the second tab the high is ok (same content), and switching back to the first the height also becomes fine.
3. After filling the form and kicking “dalej” button the content isn’t visible (too low height): https://snipboard.io/cWrKbj.jpg, but again – switching to second tab and going back to the first makes the height correct: https://snipboard.io/PdXQqn.jpgAny other ideas how to make tabs adjusting its height correctly based on content?
Adding login url just in case.
Edit: Try to do it basing on tabs (not tab selection) and the funny thing is – works perfectly! So why tab selection don’t? I leave it on the site below so you can check it.
- This reply was modified 3 years, 8 months ago by kwlodar.
April 2, 2021 at 2:56 pm #1292006Hi,
Thank you for the update. And welcome back!
We adjusted the above code a bit. Please try it again.
Best regards,
IsmaelApril 6, 2021 at 10:44 pm #1292918Hi Ismael, thank you for reply!
I’ve updated functions.php with the code again but I can not see any difference – the tab selection module act as before. :(I’ve reactivate your login link for another week.
April 9, 2021 at 7:16 am #1293427Hi,
Thank you for your patience.
We added another snippet to resize the tab section on load, which works fine, but the tab section is still not resizing consistently after going to the next step. You might have to refrain from using the tab section when using the bookly form.
This is the snippet that we added.
var int = window.setInterval(function(){ console.log("resizing"); $(window).trigger('debouncedresize'); $("a[href$=online-booking]").trigger("click"); }, 1000); $(window).load(function () { setTimeout(function() { clearInterval(int); }, 1000
Best regards,
IsmaelApril 15, 2021 at 9:56 am #1294524Hi Ismael,
sorry to hear that. :(
I believe I have to give up and search for different solution.
Best regards!
ChrisApril 18, 2021 at 5:02 am #1294951 -
AuthorPosts
- You must be logged in to reply to this topic.