The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

Opening animation properties on external file with function (jQuery)

  • Anonymous
    # May 17, 2013 at 12:19 am

    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?

    # May 17, 2013 at 12:44 am

    Something like this:

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

    height: 10
    }, animationOptions);

    # May 17, 2013 at 5:34 am

    External file could be JSON and call it with GET.

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

    # May 17, 2013 at 7:16 am

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


    How would that be written in the JSON file?

    # May 17, 2013 at 3:41 pm

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

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed