Grow your CSS skills. Land your dream job.

Chris’ Latest Article. (start and stop slider)

  • # December 4, 2008 at 7:52 pm

    hey all, I am just trying to do chris’ tutorial , I’ve written all the javascript, although I’m quite a dummy when it comes to javascript so i’ve messed somthing up and its not working, so I was wondering if someone could take a look at my javascript code and let me know if and what i’ve done wrong.

    thanks in advance
    Michael.

    Code:
    var delayLength: 40000;
    var panelWidth = 960;
    var numPanels = 3;
    var tooFar = -(panelWidth * numPanels);

    $(function(){

    $(“#slider”).append(‘Stop‘);
    function doMove() {

    var leftValue = $(“#mover”).css(“left”);
    var movement = parseFloat(leftValue, 10) – panelWidth;

    if (movement == toofar) {

    $(“.slide img”).animate({
    “top”: -200
    }, function() {
    $(“#mover”).animate){
    “left”: 0
    }, function() {
    $(“.slide img”).animate({
    “top”: 20
    });
    });
    })

    }
    else {
    $(“.slide img”).animate({
    “top”: -200
    }, function() {
    $(“#mover”).animate({
    “left”: movement
    }, function(){
    $(“.slide img”).animate({
    “top”: 20
    });
    });
    });
    };

    }

    });

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".