Hallo Mario,
im ZP-Forum wurde ein Bug in deinem Widget "Chart Animated" entdeckt, siehe Webseite springt in der mobilen Ansicht beim nach unten scrollen immer wieder zum selben Punkt zurück
Ich habe das mal untersucht und folgende Lösung gefunden:
Code
/**
* ProgressBar : Simple animated progress bar
* Author : Nayem > https://facebook.com/sadik5g
* Version : 1.0.0
*/
(function($){
$.fn.ProgressBar = function(){
var targetParent = $(this);
targetParent.each(function(){
//required variables
var target = $(this).children();
var offsetTop = $(this).offset().top;
var winHeight = $(window).height();
var data_width = target.attr("data-percent") + "%";
var data_color = target.attr("data-color");
var animationDone = false; // Animation nur einmal
//animation starts
if( winHeight > offsetTop ) {
target.css({
backgroundColor: data_color,
});
target.animate({
width: data_width,
}, 800);
}
//animation with scroll
$(window).scroll(function(){
if(animationDone) return;
var scrollBar = $(this).scrollTop();
var animateStart = offsetTop - winHeight;
if(scrollBar > animateStart) {
target.css({
backgroundColor: data_color,
});
target.animate({
width: data_width,
}, 800);
animationDone = true;
}
});
});
return this;
}
})(jQuery)
Alles anzeigen
Der Fehler bestand darin, dass die Animation beim Scrollen ständig ausgeführt wurde, was anscheinend in manchen Browsern zu einem Sprung nach oben führt. Dieser Fehler kann umgangen werden, in dem eine Variable nach dem Ausführen der Animation auf true gesetzt wird. Dadurch wird die Animation nur einmalig ausgeführt.
Könntest du dir das mal anschauen und ggf. das Widget aktualisieren?
PS: Echt tolle Arbeit, die du da mit den vielen Widgets für die Community leistest!