Scroll to top in mobile
Hi,
This is a very nice plugin. I am using it in my site. I want to add scroll to top feature for mobile device. When I click a tab it should scroll to top of the panel. Now it did not scroll. Some times it scroll to footer. Please help.
I too just noticed this issue today on a website Im developing...
This lil script using jQuery will scroll-animate the browser to the top the accordion list. Hope this helps a little bit:
$('body').on('click', '.accordion-toggle', function(){ $('html, body').animate({ scrollTop: $('.panel-group.responsive').offset().top }, 300); });
I was trying to modify the above script to scroll to the individually selected accordion option (lets say you had A LOT of tabs), but its a bit buggy and I'm sure I'm missing something. The first option works for my needs (only working with 3 or 4 tabs), but here is how I would start the base function for a site with lots of tabs:
$('body').on('click', '.accordion-toggle', function(){ var panelTitle = $(this).parents('.panel'); $('html, body').animate({ scrollTop: panelTitle.offset().top }, 300); });
Thanks for the help
Thanks,
Anushila Bharali nexplore.org
On Fri, Apr 29, 2016 at 8:13 PM, brando-online [email protected] wrote:
I too just noticed this issue today on a website Im developing...
This lil script using jQuery will scroll-animate the browser to the top the accordion list. Hope this helps a little bit:
$('body').on('click', '.accordion-toggle', function(){ $('html, body').animate({ scrollTop: $('.panel-group.responsive').offset().top }, 300); });
I was trying to modify the above script to scroll to the individually selected accordion option (lets say you had A LOT of tabs), but its a bit buggy and I'm sure I'm missing something. The first option works for my needs (only working with 3 or 4 tabs), but here is how I would start the base function for a site with lots of tabs:
` $('body').on('click', '.accordion-toggle', function(){ var panelTitle = $(this).parents('.panel');
$('html, body').animate({ scrollTop: panelTitle.offset().top }, 300);
}); `
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/openam/bootstrap-responsive-tabs/issues/53#issuecomment-215740461
Thanks!!! it help me a lot. I change it a little using JS bs collapse event.
$('.panel-collapse').on('shown.bs.collapse', function (e) {
$('html, body').animate(
{
scrollTop: $('.panel-group.responsive').offset().top
}
, 300);
});