Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lazyload or waypoint kind of waiting time #8

Closed
nmvivek opened this issue Dec 3, 2014 · 33 comments
Closed

lazyload or waypoint kind of waiting time #8

nmvivek opened this issue Dec 3, 2014 · 33 comments

Comments

@nmvivek
Copy link

nmvivek commented Dec 3, 2014

how can i animate circle while scrolling down to page ? my page is quite long and this plugin come just above the footer, but it animate, when page loads and when scroll down, can not see the circle progress effect ?

@kottenator
Copy link
Owner

You may use lazy init via jquery.appear plugin. Something like next:

var el = $('.circle'),
    inited = false;

el.appear({ force_process: true });

el.on('appear', function() {
  if (!inited) {
    el.circleProgress({ value: 0.7 });
    inited = true;
  }
});

@kottenator
Copy link
Owner

@Khabir-Ahamed: sorry but I don't understand - doesn't the example work for you?

@kottenator
Copy link
Owner

Did you try to use my example above?????!!! (with jquery.appear)

@kottenator
Copy link
Owner

That's exactly what you need: it doesn't start the circle animation until the circle appears in the viewport

This was referenced Nov 23, 2015
@longhoang2984
Copy link

Hello! I want to show near the end progress value how can I do!
Many thanks!

@coreatgit
Copy link

@kottenator
can we trigger the animation on a button click also update the startAngle of the animation from a preset variable before it begins..??

@kottenator
Copy link
Owner

@longhoang2984 - see the #52 ticket

@kottenator
Copy link
Owner

@coreatgit - yes, we can do that.

To trigger animation on a button click:

var el = $('#circle-container'),
    btn = $('#trigger-button'),
    val = 0.7;  // get it from somewhere, somehow

// Option 1: pre-render an empty circle
circle.circleProgress({ value: 0 });
btn.click(function() {
  circle.circleProgress({ value: val });
});

// Option 2: render on click
btn.click(function() {
  circle.circleProgress({ value: val });
});

@kottenator
Copy link
Owner

@longhoang2984, @coreatgit - sorry for delayed answer. I've lost your comments because you had posted them in a closed ticket.

If you want to get the answer faster next time - please, reopen a ticket or create a new one ;)

@mrshoaib
Copy link

Hi kottenotor i cant understand how can i used it please help me.................

@Yoomin233
Copy link

Great plug-in, awesome!!Just a complimentary comment!

@kottenator
Copy link
Owner

@YueminHu - thanks! ;)

@kottenator
Copy link
Owner

Hi!

All you need to do is:

It should work.

On Sun, Jun 5, 2016 at 6:08 AM Alex notifications@github.com wrote:

var el = $('.circle'),
inited = false;

el.appear({ force_process: true });

el.on('appear', function() {
if (!inited) {
el.circleProgress({ value: 0.7 });
inited = true;
}
});

how can i do this in Jquery? help plz)


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAWr2rKwtsrHQMgHpCw1GGuCJ2_3Zwihks5qIqAbgaJpZM4DDkO5
.

With regards,
Rostyslav

@devatiq
Copy link

devatiq commented Dec 7, 2016

Hi!

When we have more than one circle progress how we can use this? Changing .circle selector like .circle.second doesn't work. Any idea?

var el = $('.circle'),
    inited = false;

el.appear({ force_process: true });

el.on('appear', function() {
  if (!inited) {
    el.circleProgress({ value: 0.7 });
    inited = true;
  }
});

@kottenator
Copy link
Owner

Instead of inited global variable use $(this).data('inited', true).

@devatiq
Copy link

devatiq commented Dec 7, 2016

sorry, this not works, i'm new onto this, any full code would be much helpful. Thank you.

@Jiroscopes
Copy link

Jiroscopes commented Jan 23, 2017

how to use with multiple on the same page? you cant just change selectors as said above, and changing inited didn't work for me...

@kottenator
Copy link
Owner

kottenator commented Jan 23, 2017

@atiqbd - try this:

<div class="circle one"></div>
<div class="circle two"></div>
<div class="circle three"></div>
.circle {
  margin-bottom: 1000px;
}
var circles = $('.circle');

circles.appear({ force_process: true });

circles.on('appear', function() {
  var circle = $(this);
  if (!circle.data('inited')) {
    circle.circleProgress({ value: 0.7 });
    circle.data('inited', true);
  }
});

Here is a demo example for you.

@amichel86
Copy link

Thanks @kottenator for this awesome plugin and the solution, you're a god! 🗡

@kottenator
Copy link
Owner

Thank you, @amichel86!

I really appreciate when people like my creation and when they're saying good words to me :) That's the best and the only reward I get for my effort here.

@amichel86
Copy link

@kottenator I don't mind paying you a beer, what's your PayPal? haha

@kottenator
Copy link
Owner

Don't think I told that to get a beer :) I really appreciate your words, that's all.

(but my e-mail is in the source code, it's for PayPal too).

@joloveridge
Copy link

Great plugin and solution, loving it so far! Is there an easy solution to having multiple circles on one page each with different values that animate when you scroll them?

@Jiroscopes
Copy link

@joeyre you can just make a div for each one and call it a different name. This is what I did.

        $('.progress-bar').gradientProgressBar({
          value: 0.95
        });
        //end progress-bar 1
        $('.progress-bar-2').gradientProgressBar({
          value: 0.90
        });
        //end progress-bar-2

@joloveridge
Copy link

@Jiroscopes ahh perfect thank you!

@nataliakielbicka
Copy link

nataliakielbicka commented Jun 1, 2017

Is it possible to use appear.js with circleProgress plugin without setting any value?

We have:

el.circleProgress({ value: 0.7 });

But I want to use it in WordPress and my HTML is:

<div class="circle" data-value="0.94">
  <span>94%</span>
</div>

@kottenator
Copy link
Owner

@nataliakielbicka - this issue seems to be the most popular in my project :)

See this demo - it uses Waypoints but you can easily convert it to jquery.appear.

The idea is:

  • render circle(s) with 0 value at page load;
  • then on appearance - set the correct circle value.

This can be done in various ways.

@amichel86
Copy link

amichel86 commented Jun 1, 2017

@nataliakielbicka here's a complete example that I used on one of my recent project. I use a data-value on the circle's div to set the percentage dynamically.

<div class="circle__progress" data-value="0.8"><span>1.2G</span></div>
$('.circle__progress').circleProgress({
  value: 0,
  size: 140,
  startAngle: 4.7,
  emptyFill: "#202020",
  fill: {
    gradient: ["#fe6b26", "#cd571e"]
  }
});	

var circles = $('.circle__progress');

circles.appear({ force_process: true });

circles.on('appear', function() {
  var circle = $(this);
  if (!circle.data('inited')) {
    circle.circleProgress({ 
      value: $(this).data('value'),
    });
    circle.data('inited', true);
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

12 participants