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

Loop function / Active Class #15

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Loop function / Active Class #15

wants to merge 4 commits into from

Conversation

owex
Copy link

@owex owex commented Aug 10, 2016

  1. Loop option added to allow the text to cycle around for a set amount amount of loops.
  2. Active class added on plugin initialised. The class can be used to hide the words prior to plugin initialization and avoid the flash of all the words.

More ideas forth coming.

@MrSaints
Copy link
Owner

Apologies for not getting back to you sooner. I'll have a look this week.

Copy link
Owner

@MrSaints MrSaints left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm slightly less keen on the loop function. But then again, there might be something I'm not able to see in terms of use-case / enhancing the user's (i.e. anyone who downloads, and uses this library) experience. Thoughts welcomed.

@@ -22,6 +22,8 @@
animation: "bounceIn",
separator: ",",
speed: 2000,
activeClass: 'active',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use double quotes here for consistency? I think with the new ESLint configuration, this should be caught.

@@ -22,6 +22,8 @@
animation: "bounceIn",
separator: ",",
speed: 2000,
activeClass: 'active',
loop: 10, // loop n times around TBC
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I'm keen on including an out-of-the-box support for a loop limit. Seems like something that can be achieved by the complete callback.




//console.log(this.position);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly want to remove the comment here.

this.index = ++this.index % this.phrases.length;
this.element[0].innerHTML = "<span class=\"animated " + this.settings.animation + "\">" + this.phrases[this.index] + "</span>";
this.element[0].classList.add(this.settings.activeClass);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's necessary for us to add in every iteration. I feel like there should be a more elegant solution (e.g. setting a base class on the parent element, and having its style get overwritten by morphext on line 41/45).

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

Successfully merging this pull request may close these issues.

2 participants