PaulAA Posted May 24, 2020 Share Posted May 24, 2020 Site URL: https://elbuhololava.quarespace.com Im using the following code. The intentions is to show a kind of visits to the page. But i want it to increase over time, lets say, add 5 every day. can you help me?? www.elbuhololava.quarespace.com Password "elbuho". Thanks!! <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script> var a = 0; $(window).scroll(function() { var oTop = $('#counter').offset().top - window.innerHeight; if (a == 0 && $(window).scrollTop() > oTop) { $('.counter-value').each(function() { var $this = $(this), countTo = $this.attr('data-count'); $({ countNum: $this.text() }).animate({ countNum: countTo }, { duration: 2000, easing: 'swing', step: function() { $this.text(Math.floor(this.countNum)); }, complete: function() { $this.text(this.countNum); } }); }); a = 1; } }); </script> <div id="counter"> <div class="sqs-col sqs-col-4 counter-value" data-count="163" data-desc=" Autos Lavados">0</div> <style> .counter-value { font-size: 50px; line-height:1.4em; text-align:center; padding:18px 0; } .counter-value:after { content: attr(data-desc); display:block; text-transform:uppercase; font-size: 20px; line-height:1.3em; } <div id="counter" data-startdate="31/12/2010"> <div class="sqs-col sqs-col-4 counter-value" data-dailyincrement="2" data-count="200" data-desc=" Autos Lavados">0</div> </div> </style> Link to comment
tuanphan Posted June 9, 2020 Share Posted June 9, 2020 try edit duration with 2000 = 2 seconds Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
PaulAA Posted June 11, 2020 Author Share Posted June 11, 2020 Didnt work, goes back to zero. any other way? Link to comment
RyanDejaegher Posted June 11, 2020 Share Posted June 11, 2020 10 minutes ago, PaulAA said: Didnt work, goes back to zero. any other way? @PaulAA you won't be able to save a visitor count unless you save that count somewhere, either with a cookie or through localStorage. Philadelphia, PA 👉 Squarespace Tutorials Chat/Message on FB Messenger for quickest response: https://m.me/dejaegherryan Link to comment
PaulAA Posted June 15, 2020 Author Share Posted June 15, 2020 i just want it to randomly increase, it doesn´t have to be real. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.