Change Image with transition effects

I have the following script that changes my image on a timer:

var da = setInterval( function() {

    var current_image = document.getElementById('node_picture').src;
    var image_index = current_image.substring(48,49);
    image_index++;

    if (image_index > 4) {
        image_index = 1;
    }

    document.getElementById('node_picture').src="img/node/<?php echo $node_id ?>/" + image_index + ".png";

}, 4000);

I am trying to add a jQuery FadeIn() effect. I tried to add

$('node_picture').FadeIn();

but that does not work.

Thanks,

Answers


Note the case here:

$('node_picture').fadeIn();

http://api.jquery.com/fadeIn/

NB: All jQuery methods and properties use camel case with the initial letter in lower case.


When working with selectors, ids should be prefixed with the hash # symbol. I missed this the first time around, your comment made me take another look:

$('node_picture').fadeIn();  // wrong
$('#node_picture').fadeIn(); // right

http://api.jquery.com/id-selector/

-- Unless that's also a typo? ;-)


Need Your Help

Arabic Issue with PHPMailer

php encoding phpmailer

I am using PHPMailer and trying to send email with the Arabic text, It's sending the Empty Subject , I can see in my Inbox "(no subject)"

Data not fetched by angularjs app on deployment

javascript angularjs service web-deployment factory

I'm developing the angularjs app in local server i.e localhost. And I've shared the link of the project with my current IP address in my network, so that i could get feed-backs from my colleagues. ...