Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

counter plus minus for quantity

// counter js 
var a = 0;
$(window).scroll(function() {

  var oTop = $('#counter').offset().top - window.innerHeight;
  if (a == 0 && $(window).scrollTop() > oTop) {
    // console.log('hello');
    $('.counter-value').each(function() {
      var $this = $(this),
        countTo = $this.attr('data-count');
      $({
        countNum: $this.text()
      }).animate({
          countNum: countTo
        },

        {

          duration: 5000,
          easing: 'swing',
          step: function() {
            $this.text(Math.floor(this.countNum));
          },
          complete: function() {
            $this.text(this.countNum);
            //alert('finished');
          }

        });
    });
    a = 1;
  }

});
Comment

PREVIOUS NEXT
Code Example
Javascript :: angular + An unhandled exception occurred: Transform failed with 1 error: 
Javascript :: how to access property from inside an array 
Javascript :: copy multi cell value from one sheet to another using google app script 
Javascript :: Plumsail add a button to the left side of the toolbar, which will be hidden until an item is selected 
Javascript :: js draw number in range 
Javascript :: visual studio code shortcut to find file 
Javascript :: jsdoc run for all files in folder 
Javascript :: node js knex sqlite query 
Javascript :: vite build output destination change 
Javascript :: RangePicker 
Javascript :: javascript How can i do optional function 
Javascript :: { "typeof": false } 
Javascript :: Setting the default value in the drop down list in AngularJS 
Javascript :: Delete Button not working with json server using angularjs 
Javascript :: AngularJS - get previous selected option after ng-click on a ng-repeat 
Javascript :: Why am I getting an error, "ReferenceError: categories is not defined" in AngularJS 
Javascript :: Why is <CalendarStrip / not working properly 
Javascript :: react js graph with more than one y axis 
Javascript :: the given sign-in provider is disabled for this firebase project 
Javascript :: How to limit properties of a JSON object given array of property names using JQ 
Javascript :: promsie js 
Javascript :: open div with onClick element position 
Javascript :: in nav link if I click on the same active link, page has to refresh in react js 
Javascript :: phaser remove collider on stop 
Javascript :: javascript cookies all together 
Javascript :: kendo grid column template based on condition 
Javascript :: Download A File With Link Using ExpressJS 
Javascript :: Use Dynamic Scales 
Javascript :: Dependency Injection in Node.js 
Javascript :: useState intro 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =