Closed hassanjaved110 closed 3 years ago
for return-to-top
https://github.com/idiotWu/smooth-scrollbar/blob/develop/docs/api.md#scrollbarscrollto
for inview scroll animation if you using gsap
upgrade it to latest version and use ScrollTrigger API
or
go to SmoothScrollbar API
https://github.com/idiotWu/smooth-scrollbar/blob/develop/docs/api.md#scrollbarscrolltop
i am using smooth-scrollbar and this code:
var scrollTop = $("#return-to-top"); //Click event to scroll to top $(scrollTop).click(function() { $('html, body').animate({ scrollTop: 0 }, 800); return false; });
on click "return-to-top" not going to top of the window/page.
and
also not working my counter code and also not giving any error in console.! hope you will have another solution for me thanks.
var counted = 0; $(window).on('scroll', function() { var oTop = $('#counter').offset().top - window.innerHeight; if (counted == 0 && $(window).scrollTop() > oTop) { alert(); $('.count').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); } }); }); counted = 1; } });
I am used This cod: But it still not working.
$(function(){ $("#return-to-top").on("click", function(){ TweenMax.to($(window), 1, { scrollTo:{ y: $("body").offset().top, autoKill: true }, ease:Power3.easeOut }); return false; }); });