benutze Ich versuche, jquery-circle-progress (https://github.com/kottenator/jquery-circle-progress) zu verwenden, animiere, wenn Benutzer blättern in diesen Ort. Ich konnte etwas mit dem Bug machen. Problem ist die Animation wiederholt sich. Ich möchte es nur einmal animieren, wenn der Benutzer zu diesem Ort scrollt. Hier ist meine Arbeit:Wie man jquery css ('display', 'block') und css ('display', 'none') in if else statement
jquery:
$(window).scroll(function() {
var windowWidth = $(this).width();
var windowHeight = $(this).height();
var windowScrollTop = $(this).scrollTop();
$(document).ready(function() {
$('#circle').circleProgress({
value: 0.75,
size: 180,
fill: {
gradient: ["lightblue", "grey"]
}
});
});
if (windowScrollTop > 760) {
$('#circle').css('display', 'block');
} else {
$('#circle').css('display', 'none');
}
});
html:
<div id="circle"></div>
CSS:
#circle {
text-align: center;
}
Inhalt von '$ (document) .ready (function() {});' außerhalb von '$ (window) .scroll (function() {});' –
Jetzt funktioniert es aber meine Hauptabsicht was ist zu animieren mit Scroll funktioniert nicht. – mlhazan