The following code is working in firefox but not in chrome. It's got me stumped.
$('html, body').animate({scrollTop: $('.panel-group').offset().top}, 800, 'swing');
I done some research and the code looks fine for me. I also tried the answers provides in this post but none helped me.
It might be worth noting that this code is connected to the folowing code:
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
var loadcommentform = getParameterByName('loadcommentform');
if (loadcommentform === 'true') {
$('.horizontalTabs, .tab-pane').removeClass('active');
$('.activateComments').parent().addClass('active');
$('#commentsTabArea').addClass('active');
$('.accordion-toggle').addClass('collapsed');
$('.activateComments').removeClass('collapsed');
$('.panel-collapse').removeClass('in');
$('#collapse-commentsTabArea').addClass('in');
$('html, body').animate({scrollTop: $('.panel-group').offset().top}, 800, 'swing');
}
It detects if the url get paramater is present.
When I put alert(loadcommentform);
inside the if statement I get the alert so I know the code is running. and I get no javascript errors in the browser dev tools console.
Thanks for the help :)