Tagged: x
-
AuthorPosts
-
March 16, 2017 at 5:43 am #1409406
Hi there,
I was looking for a solution to have an expanding section.
On my site: https://mybetterlife.de/#stimmen there some client voices.
Underneath the row with four columns should be a button (show more) that expands the section with another 4 column row.I found this solution for hiding/showing entire sections:
Is it also possible for rows?
Thank you!
March 16, 2017 at 9:01 am #1409587Hi There,
It does work.
Add the following code to Cornerstoen Settings Custom Javascript:
jQuery(document).ready(function($){ $('.section-expandable').slideToggle(0); $('.section-trigger').on('touchend click',function(e){ e.preventDefault(); $('.section-expandable').slideToggle('slow') $('html, body').animate({ scrollTop: $(".section-expandable").offset().top }, 700, 'swing'); }) });
Add the class : section-expandable to your row.
Add the class: section-trigger to the button.
Hope it helps
Joao
March 16, 2017 at 10:31 am #1409738Thank you, that works perfect!
Is it also possible to hide/show multiple rows with that trigger button?
March 16, 2017 at 12:06 pm #1409861Hi there,
It should work if you use the same class for other Rows. Let’s try and let us know if that works.
Thanks!
March 17, 2017 at 3:23 am #1410771Hi Rupok,
thanks I’m gonna try this.
In the meantime i recognized that the expanding function doesn’t work mobile (testet with Android, Chrome).
The hidden row shows up from the beginning before the trigger button has been clicked.Any idea how to fix this?
Thank you
March 17, 2017 at 2:36 pm #1411391Hi again,
Try replacing the previous code with the following code:
jQuery(document).ready(function($){ $('.section-expandable').slideToggle(0); $('.section-trigger').on('click',function(e){ e.preventDefault(); $('.section-expandable').slideToggle('slow'); $('html, body').animate({ scrollTop: $(".section-expandable").offset().top }, 700, 'swing'); }); });
Don’t forget to clear your browser’s cache after adding the code. Let us know how this goes!
March 18, 2017 at 7:01 am #1412069Hi Nabeel,
thank you so much, that worked!
To make it complete: will it work to have an on click function for the trigger button
to show different text (‘Show more’/’Show less’)?Something like this?:
$('.SeeMore2').click(function(){ var $this = $(this); $this.toggleClass('SeeMore2'); if($this.hasClass('SeeMore2')){ $this.text('See More'); } else { $this.text('See Less'); } });
March 18, 2017 at 11:17 am #1412169Please try with this code:
jQuery(document).ready(function($){ $('.section-expandable').slideToggle(0); $('.section-trigger').on('click',function(e){ e.preventDefault(); $('.section-expandable').slideToggle('slow'); $('html, body').animate({ scrollTop: $(".section-expandable").offset().top }, 700, 'swing'); $(this).toggleClass('seemore'); if($(this).hasClass('seemore')){ $(this).text('See More'); } else { $(this).text('See Less'); } }); });
Hope it helps 🙂
March 18, 2017 at 5:07 pm #1412337Thank you, works perfect!
March 19, 2017 at 7:16 am #1412707You’re most welcome 🙂
-
AuthorPosts