Git Product home page Git Product logo

Comments (16)

legomushroom avatar legomushroom commented on May 5, 2024 1

The issue like that usually appears if you place the link to the lib inside the head tag.

The library adds it's modules to the parent option (this.o.parent) you have specified on module construction, if you haven't specify anything in parent option, it fallbacks to the body:
((this.o.parent || document.body).appendChild). Thus it tries to access body that hasn't been yet initialised. If you move the script inside body tag (or better to the end of the body tag), it should solve the issue.

Hope it helps.

from mojs.

legomushroom avatar legomushroom commented on May 5, 2024

Hey @Jordan4jc! Thanks for the alert!

Cloud you please make the issue sample somewhere on codepen or similar? Not sure I got the problem right. The error seems for that you are passing an object but not HTMLNode to parent option. jQuery's .get(0) will get HTMLNode for you so it solves the issue.

Still not sure what do you want to achieve, a small code sample will help a lot.
Thanks!

from mojs.

kmiyashiro avatar kmiyashiro commented on May 5, 2024

@Jordan4jc try using https://api.jquery.com/toArray/ to get an array of elements in your selection. I would suggest building a mixin or helper to call the animation code directly from the components as well.

from mojs.

legomushroom avatar legomushroom commented on May 5, 2024

Hi @kmiyashiro! Thanks for the solution. I still don't get the issue and would deeply appreciate if you could make a code sample with it? Thanks!

from mojs.

jrdn91 avatar jrdn91 commented on May 5, 2024

I have plans to try to make a code sample to see if I can get the same effect, I'll also give the toArray a shot as right now I'm hacking it to make it work. @kmiyashiro I plan on making it a mixin or a component once I find the best way to put it all together. Probably as soon as mo.js docs get a bit more full.

from mojs.

legomushroom avatar legomushroom commented on May 5, 2024

@Jordan4jc thanks!

from mojs.

BenevidesLecontes avatar BenevidesLecontes commented on May 5, 2024

I have this issue too, what i want to do, is select all elements with some classes and animate all of them, instead of using pure js like (using like this, work great, for one element):
screen shot 2016-03-22 at 1 02 16 am

I would like to use:
screen shot 2016-03-22 at 1 02 35 am
But when i use the code above i get the same error as @Jordan4jc mentioned
screen shot 2016-03-22 at 1 05 46 am

from mojs.

TheSisb avatar TheSisb commented on May 5, 2024

From that error, it seems like appendChild() is being called on some element. My guess is that it is getting a DOM element, so you should look into wrapping it like this:

$(this.o.parent || document.body).appendChild

to turn it into a jQuery object with that function available.

from mojs.

BenevidesLecontes avatar BenevidesLecontes commented on May 5, 2024

@legomushroom I have my scripts at the end of body tag and i have timeout as well. So, for me this isn't the solution. Thanks.

from mojs.

legomushroom avatar legomushroom commented on May 5, 2024

@BenevidesLecontes could you make an example on codepen?

from mojs.

BenevidesLecontes avatar BenevidesLecontes commented on May 5, 2024

@legomushroom take this plunker http://plnkr.co/edit/urqqKI?p=preview, click on resolveview link and test. You'll see icons animating, using pure js, uncomment the line using jquery and you'll see the error on the console. Thanks

from mojs.

legomushroom avatar legomushroom commented on May 5, 2024

@BenevidesLecontes thanks for the demo.
If you use var el11 = document.querySelectorAll('span.icobutton')[0] - you take the first element in the search - [0]. So when you use $, take the first element too:

var el11 = angular.element($('span.icobutton')[0]), el11span = angular.element($('i.fa-microphone')[0]);

This way no errors fire. [http://plnkr.co/edit/g2xz2g6OuP7ZG4rjXJKK?p=preview]

As I got it, you want both icons to work the same way?

from mojs.

BenevidesLecontes avatar BenevidesLecontes commented on May 5, 2024

Yes I want to select all the items and animate them all the same way. With your edited line, the error keep showing in the console and the icons don't work.

from mojs.

legomushroom avatar legomushroom commented on May 5, 2024

@BenevidesLecontes updated the plunker http://plnkr.co/edit/g2xz2g6OuP7ZG4rjXJKK?p=preview

from mojs.

legomushroom avatar legomushroom commented on May 5, 2024

@BenevidesLecontes pushed more updates. Right now it creates the animation sequence for each icon with createAnimation function. Note that the parent option expects DOMNode -- not jQuery wrapped element nor NodeList. The next mojs release that I will make shortly will allow you to easily reuse the same sequence multiple times. Hope it helps.

from mojs.

BenevidesLecontes avatar BenevidesLecontes commented on May 5, 2024

@legomushroom Thanks for the help and thanks for this amazing library.

from mojs.

Related Issues (20)

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.