Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

jquery animate wont work

jquery animate wont work

Problem

jQuery-newbie here.

I want to do a simple horizontal scroll function with two buttons. I want to do it with animate. But when I click on one of the buttons, nothing happens...

Heres the jQuery Code:

This is the HTML code:

( )
...

(I've also tried it with an a-Tag)

Aaaaand here's the css:

#main {
    border: solid 1px #fff;
    max-height: 480px;
    width: auto;
    display: block;
    overflow: hidden;
    background: #ddd;
}

#main #box {
    width: 2250px;
    display: inline;
    float: left;
    position: relative;
}

#main .column {
    float: left;
    display: inline;
    padding: 10px;
    width: 429px;
    border-left: solid 1px #333;
    height: 460px;
}

.scrollbutton {
    font-family: "WebSymbolsRegular";
    font-size: 30px;
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.left {
    float: left;
}

.right {
    float: right;
}

It's probably a very naive error, but I just have no idea what it is... I hope you can help me :)

PS: You can find it here: http://patrickmanser.ch/pixelsword/

Problem courtesy of: Patrick

Solution

$('#right-button').click(function() {
        $('#box').animate({
        left: "+=200px"
        }, "fast");
    });

    $('#left-button').click(function() {
        $('#box').animate({
        left: "-=200px"
        }, "fast");
    });

function() ;-)

Solution courtesy of: Alex Ball

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

jquery animate wont work

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×