Giter Club home page Giter Club logo

morphext's Introduction

Morphext

Dev Dependency Status

A simple, high-performance and cross-browser jQuery rotating / carousel plugin for text phrases powered by Animate.css. It is more succinctly described by Softpedia as:

A jQuery plugin for creating text-based carousels, rotating small or large pieces of text one after the other, just like a slider does with images... This can be a great tool for displaying catch phrases, mission statements, tag lines, and so on.

If you would like to achieve a similar effect with more flexibility (e.g. out animation) and with HTML objects rather than text phrases (e.g. unordered list items), please check out Morphist.

Website / Demo

Install

Download from the project page.

Install with Bower: bower install --save Morphext

Usage

  1. Import the latest Animate.css and jQuery library into your HTML.

  2. Import morphext.css and include morphext.min.js in your HTML document.

  3. Encapsulate your rotating phrases in an element and separate each phrase with a comma or a separator of your choice:

    I am a <span id="js-rotating">So Simple, Very Doge, Much Wow, Such Cool</span> Text Rotator
  4. Trigger the plugin by calling Morphext() on the element containing the rotating phrases:

    $("#js-rotating").Morphext();

A demo titled index.html is included in this repository. Open it to see the end-result.

Options

Morphext exposes the following options to alter the behaviour of the plugin:

Option Type Default Description
animation string bounceIn The [in] animation type. Refer to Animate.css for a list of available animations.
separator string , An array of phrases to rotate are created based on this separator. Change it if you wish to separate the phrases differently (e.g. So Simple / Very Doge / Much Wow / Such Cool).
speed int 2000 The delay between the changing of each phrase in milliseconds.
complete object Function null A callback that is executed after an item is animated in.

They may be used like so:

$("#js-rotating").Morphext({
    animation: "fadeIn", // Overrides default "bounceIn"
    separator: "|", // Overrides default ","
    speed: 3000, // Overrides default 2000
    complete: function () {
        // Overrides default empty function
    }
});

The plugin relies heavily on Animate.css for its smooth, high performance animations to transition between each phrase. Thus, the default animation speed (different from the interval between each phrase as described above) may be altered via CSS:

#yourElement, .yourClass {
    /* Overrides Animate.css 1s duration */
    -vendor-animation-duration: 3s;
}

"Issues"

Issue Description Solution
Viewport Certain animations (e.g. "up" and "down") by Animate.css involves translating the element beyond the viewport thereby leading to unintended vertical and/or horizontal whitespace (further evident by the scrollbar "following" the animation effect. This is not a bug. It may be eradicated by applying overflow: hidden; (CSS) to the parent of the element being animated.
JavaScript JavaScript is required for the addition / removal of elements with Animate.css [CSS animation] classes thereby creating the "transitioning effect". If JavaScript is disabled or unavailable, nothing will happen. All the phrases and its separator will be shown as it is (graceful degradation). N/A
CSS3 Animate.css relies on CSS3 animations and transformations (available in most modern browsers). If CSS3 is disabled or unavailable, the phrases will continue to transition from one to another (assuming JavaScript is enabled), but there will be no animation effect. No fallback is provided by this plugin. You may however, handle the fallback through the use of Modernizr (for feature detection) and polyfills.

Should you encounter any problems or require assistance with this plugin, simply open a GitHub issue in this repository or you may contact me via Twitter.

Prerequisites

Others

Native ports of Morphext have been developed in other JavaScript frameworks (e.g. React and Polymer):

They are not part of the official plugin development and the approach used in developing these ports may not be idiomatic. Please use them at your own risk.

Issues and pull requests are welcomed.

License

Morphext is licensed under the MIT license (http://ian.mit-license.org/).

morphext's People

Contributors

jacobq avatar mrsaints avatar tyliec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

morphext's Issues

Event Handler

Hi, great plugin!

I am just wondering, is there a way to add stop, start, play, resume events to be called outside the plugin?

Thank you!

Reset to first word upon click of a button

Hi there,

I'm looking to reset Morphext back to the first word once a button is clicked - for example, this is the current jquery I'm using to initiate the animation.

 $("#js-rotating").Morphext({
      animation: "fadeInUp",
      separator: ",",
      speed: 1200,
      complete: function () {}
    });

And I want to have another function such as

$(".hero-button").click(function(){
     (restart the morphext animation at the first word)
 });

Thanks in advance for your help!

Update docs

The website is out-of-date. Ideally, I'd like to split up the README.md, and put the docs in a separate directory. The docs should also contain information on design patterns.

more compress and seccure this plugin

(function($,c,l,d){"use strict";d={animation:"fadeInDown",separator:",",speed:2e3,complete:$.noop};function a(b,f){var e=$(b).addClass(c),se=$.extend({},d,f),t=this,ph=[],ival,i;t.animate=function(){i=++i%ph.length;e.html('<span class="animated '+se.animation+'">'+ph[i]+"</span>");$.isFunction(se.complete)&&se.complete.call(t)};t.start=function(){ival=setInterval(t.animate,se.speed)};t.stop=function(){clearInterval(ival)};$.each(e.html().split(se.separator),function(k,v){ph.push($.trim(v))});i=-1;t.animate();t.start()}$.fn[c]=function(d){return this.each(function(){$.data(this,l+c)||$.data(this,l+c,new a(this,d))})}})(jQuery,"morphext","plugin_");

Choosing where to stop animation

Stop the animation okay, but you can choose which word stoper?
For example if I want the animation will stop on the last word, how do I do?

How to override options?

`$.fn.Morphext.defaults = {
animation: "fadeInLeft"
};

let morp = $('.js-rotating').Morphext();
let dataMorp = morp.data("plugin_Morphext");
console.log(dataMorp);
`
i'm try to override it but when it check the animation has't changed

By the way i want to use it in the selector '.js-rotating' that will trigger when event handler is mousehover. So the next is using this dataMorp.start() function that why i not set the animation on this line $('.js-rotating').Morphext() this is just for check current animation;

Conflict with the animate.css latest version!

Hi,

Unfortunatly I cannot install the lib via Bower, here is why:

$ bower install Morphext --save
bower Morphext#*                cached https://github.com/MrSaints/Morphext.git#2.4.4
bower Morphext#*              validate 2.4.4 against https://github.com/MrSaints/Morphext.git#*
bower animate.css#~3.2.5        cached https://github.com/daneden/animate.css.git#3.2.6
bower animate.css#~3.2.5      validate 3.2.6 against https://github.com/daneden/animate.css.git#~3.2.5
bower jquery#~2.1.4             cached https://github.com/jquery/jquery-dist.git#2.1.4
bower jquery#~2.1.4           validate 2.1.4 against https://github.com/jquery/jquery-dist.git#~2.1.4
bower jquery#>=1.5              cached https://github.com/jquery/jquery-dist.git#3.1.1
bower jquery#>=1.5            validate 3.1.1 against https://github.com/jquery/jquery-dist.git#>=1.5
bower jquery#>=1.7.2            cached https://github.com/jquery/jquery-dist.git#3.1.1
bower jquery#>=1.7.2          validate 3.1.1 against https://github.com/jquery/jquery-dist.git#>=1.7.2
bower jquery#>=1.4.4            cached https://github.com/jquery/jquery-dist.git#3.1.1
bower jquery#>=1.4.4          validate 3.1.1 against https://github.com/jquery/jquery-dist.git#>=1.4.4
bower jquery#>= 1.2.1           cached https://github.com/jquery/jquery-dist.git#3.1.1
bower jquery#>= 1.2.1         validate 3.1.1 against https://github.com/jquery/jquery-dist.git#>= 1.2.1
bower jquery#>= 1.9.0           cached https://github.com/jquery/jquery-dist.git#3.1.1
bower jquery#>= 1.9.0         validate 3.1.1 against https://github.com/jquery/jquery-dist.git#>= 1.9.0
bower                        ECONFLICT Unable to find suitable version for animate.css

I already have jQuery 3.1.1 and Animate.css 3.5.2 installed for my project... I don't know why I get this error! Do you have any idea?

Cuts tags

Hi. When I use Morphext for element, he cuts all html tags exept plain text. How I can disable it?

Prevent all phrases from flashing inside rotating element on page load

Is there anyway to prevent all the phrases from flashing when the page is reloaded? Everything inside the element will appear at once for a quick second before the animation triggers.

index.html

<h4><span id="js-rotating">Software Engineer | Developer | Programmer</span></h4><br>

main.js

 $("#js-rotating").Morphext({
    animation: "flipInX",
    separator: "|",
    speed: 3000
 });

Morphext is not a function

I cannot get Morphext function to loaded.

HTML is available here: https://pastebin.com/94mx9ZV1

14: Jquery Loaded.
16:Animate Loaded.
17:Morpheus Loaded.
97: Span.
136: Start of configuration. (Yes I know I have wrong ID on that paste. But even with right ID it's not working.)

Error Code:

internal-dev.ironlions.fi/:137 Uncaught TypeError: $(...).Morphext is not a function
at internal-dev.ironlions.fi/:137
(anonymous) @ internal-dev.ironlions.fi/:137

Roadmap 2015

If you need assistance with the plugin but you do not have a Github or a Twitter account, you can drop a question at my Ask.fm.

We, as a community, have made several changes to this project since its inception in 2013. It was originally inspired by Simple Text Rotator and driven by the need for an up-to-date / modern plugin for text transitions.

In 2014, I had focused my attention on fine-tuning it (albeit unnecessary at times due to the negligible impact), and on increasing its flexibility (mostly encouraged by users' requests) by introducing new, meaningful methods (internal and external).

Looking ahead in 2015 (and possibly 2016), I intend on doing the following:

  • Porting the plugin over to React.js and Polymer (something I had already begun working on, but not to a standard that I deem acceptable / stable)
  • Possibly introducing ES6 to the plugin (I will need to look further into this and see if it is even worthwhile or advisable to do so)
  • Developing a more advance version of this plugin and Morphist (i.e. animating individual letters - I have also already begun working on this)
  • Updating the documentation and the website (make it easier for people to deploy this and understand the difference between this and Morphist)
  • Collating a list of sites that are currently using it (you can leave your URL in the comments in preparation for this)
  • Release a Wordpress plugin

At the same time, I would like to stick to its original philosophy:

  • Simplicity (all aspects, i.e. understanding how it works, modifying it and using it)
  • Performance (optimum solutions to achieve the desired effects)
  • It should do one thing, and do it well (which is why Morphist is on a separate repository)
  • Lightweight (similar to the previous ones; no unnecessary bloat)
  • Compatible (across most browsers)
  • Open (by the community, for the community)

Balancing these different considerations is not going to be an easy job and certain conditions will be given a greater priority than others.

As always, suggestions and questions will always be entertained.

Have a good year everyone.

P.S. Be sure to give Morphist some love as well!

EDIT: Let's start collecting cool typography effects...

Shuffle ?

Hi there !

Thanks for creating Morphext :)

Are you planning to add a shuffle feature ? That could be cool.

Thanks !

Stop after completed

Is there a way to stop the loop? I tried using complete function but I guess that is for each item after completed am I right?

Help request safari buggy in front of video

Hi

Thanks for pointing me to your plugin.
Im having problem with safari and flipping text in front of a html 5 "background" video.

Don't think there is something wrong with the plugin just need to figure out why it happens.

www.pija.se

Working on smaller/compressing video so it might take while before it starts. And flipping works until video starts.

Changing rotation speed for last few phrases

I'm looking to have the last x number of words rotate at a different speed than the others. Say, have the first 20 phrases rotate at a speed of 500, and the last 5 rotate at a speed of 1000. I've been able to do this with the animation, but not the speed - so I've been unable to produce the desired result unfortunately. Any assistance would be much appreciated.

How to remove an animation after it has completed?

How does one remove an animation once it is completed? For instance, after the bounceIn animation has finished its animation how does one ensure that it isn't animated once more? And, when a new call to Morphext is performed that the animation runs again.

I tried this,

$("#prompt").Morphext({
    speed: 2000,
    complete: function () {
        // Called after the entrance animation is executed.
        this.stop();
        setTimeout(function() {
            // Remove the span while keeping the text.
            var wrap = $('span.animated.bounceIn');
            var text = wrap.text();
            wrap.replaceWith(text);
        }, 1900);
    }
});  

and obviously I have no idea what I am doing.

Add fadeInfadeOut stuff

Ideally what I'd like is fade in/fade out animations. Right now I can only get it to fade in, and then it abruptly flashes out when it leaves.

Fade Out Animation

Hello,
i want add a fade Out animation after each fade in animation ?
Thx for ur work

Compatibility with I.E < 8

It is not working wiht IE < 8, print that message:

Object doesn´t support this property or method
line: 44
character: 17

linebreak

Hello,

Is it possible to use linebreak for some of the words?

<span class="rotating"HELLO<br>WORLD1,HELLO<br>WORLD2,HELLO WORLD3,HELLO<br>WORLD4,HELLO WORLD5</span>

I had tried using br and but it doesn't work.

Iteration control & using a 2nd or third <span>

Great tooling leveraging Animate.CSS
~ ~
Using Animate.CSS I have been able to control iterations & delays; i.e.
animation-iteration-count: 1;
-webkit-animation-iteration-count: 1;
-ms-animation-iteration-count: 1;
Please direct me how to control these using Morphext
~ ~
with iterations set to "1"
How can use a second / third set of phases..?
I would use this when I where I would change the animated Class from, say, zoomIn to bounce

Thanks for your help......
~ ~ ~
as a reference I am trying to replicate the online FLASH version of an aninote.
my edit... my name: http://dale.you.are.mighty.aninote.com/
Aninote, main site reference: http://www.aninote.com/site.mpl?p=cont&cont=yam
~ ~ ~ .
Thanks for this and any further ideas.....

D-

Skip to next Word

Is there a way to skip to the next word via jQuery on("click") Function?

Changing speed of animation depending on index

Good night, im stuck on an animation, the thing is , i have three lines paragraph, and they transalte in the animation from english to spanish, and the client wants, the english paragraph stays in english 15 seconds, and 4 seconds in spanish, and keep doing it in a loop, i only had achieved to change three times but then the animation stops. Can anyone help me? thanks

Plugin removes HTML tags on words

I need to keep HTML tag on the words, ie:

I am a <span id="js-rotating">So Simple, <b>Very Doge</b>, <span class=""myclass>Much Wow</span>, Such Cool</span> Text Rotator

The plugin removes any HTML tags on the words. I know that probably this plugin is only for text (unformatted), but your plugin is awesome and the only thing I need is keeping html tags. Could you help me?

Thanks

Question solved:
How can I stop the rotate after it rotates all the words? I don't want a loop.

EDIT: solved with this #12

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.