visionmedia / move.js

CSS3 backed JavaScript animation framework
http://visionmedia.github.com/move.js/
4.72k stars 686 forks source link

move in not defined #62

Open ZigaVukcevicDev opened 9 years ago

ZigaVukcevicDev commented 9 years ago

Hi,

I am having difficulties to set up move.js

Here is my code:

<script src="<?php echo base_url('assets/js/lib/jquery-1.11.1.min.js'); ?>"></script>
<script src="<?php echo base_url('assets/js/lib/move.min.js'); ?>"></script>

and

$('.some_selector').on('click', function() {
  move('.some_selector')
    .duration(1000)
    .set('opacity', 1)
    .add('left', 500)
    .end();
});

I am getting following errors:

move.min.js:1 Uncaught TypeError: Cannot read property 'style' of null
main.js:60 Uncaught ReferenceError: move is not defined

Can you please provide some assistance?

benweet commented 9 years ago

Same problem here. Resolved by including the script tag in the body instead of the head of the html.

frkd-dev commented 9 years ago

When MoveJS included before body element it fails to initialize, because it tries to access document.body.style which isn't yet created. Strange that such behavior is not covered by docs.

michahell commented 9 years ago

Confirmed, moving script tag to body resolved it indeed.