Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Opening animation properties on external file with function (jQuery)

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #44836
    Anonymous
    Inactive

    i have a function like ths

    $(“.nav_button”).click(function() {
    $(“.slides”).animate({ animation properties here });
    });

    What i want todo is store the animation properties in a separate jquery file and call that file with that function. And the animation occurs according to the properties in the external file. And how would the properties in the external file be written?

    #135383
    TheDoc
    Member

    Something like this:

    var animationOptions = {
    duration : 400,
    easing : ‘swing’
    }

    $(‘.slides’).animate({
    height: 10
    }, animationOptions);

    #135404
    CrocoDillon
    Participant

    External file could be JSON and call it with GET.

    $.getJSON(‘/path/to/file.json’, function(data) {
    console.log(data); // verify it works
    });

    #135409
    Anonymous
    Inactive

    @CrocoDillon but how would the animation properties be written in the JSON file? This is the animation i have

    $(“.slides”).animate({left:’100%’});

    How would that be written in the JSON file?

    #135479
    CrocoDillon
    Participant

    I’m guessing `{left:’100%’}`, in a file named .json could work.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.