Call external library Demo Experiment Run Experiment

Call external library

Jaap Murre

This demo illustrates how to load such an external library and then use it.

This example uses jQuery to download an external library. Only use this technique if you really have to as downloaded components may conflict with some of the existing code and styles. For example, many libraries require to also down load a stylesheet, which may complicate things.

If you are a registered user and signed in, you can here copy this script and its stimuli to your own account, where you can edit it and change it in any way you want.

It is absolutely free to register (no credit card info asked!). You can then instantly copy this experiment with one click and edit it, change its accompanying texts, its landing page, stimuli, etc. Invite your colleagues, friends, or students to check out your experiment. There is no limit on how many people can do your experiment, even with a free account.

The catch? There is no catch! Just keep in mind that with a free account, you cannot collect data. For teaching that is usually not a problem. For research, prepaid data collection (unlimited subjects) starts as low as €10.00 for a 10-day period.

// This example pulls in the jquery color animation plugin
// see https://github.com/jquery/jquery-color
// N.B. Many libraries ALSO require a css link
$.getScript("https://code.jquery.com/color/jquery.color.js", function() {

    // All of your code that depends on the library being present should go here
    // E.g.,

    var b = addblock(20,20,60,20);

    $(b.node) // This is the DOM node of a Block, see https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model
    .animate({
        backgroundColor: "rgb(255, 180, 180)"
    },1000)
    .delay(500)
    .animate({
        backgroundColor: "olive"
    },1000)
    .delay(500)
    .animate({
        backgroundColor: "#00f"
    },1000);
});

await(5000);

You can download the files as follows: Click on the file (link) and then right-click and choose Save as... from the menu. Some media files (e.g., sound) will have a download button for this purpose.

This experiment has no files of this type
This experiment has no files of this type
This experiment has no files of this type
This experiment has no YouTube links
This experiment has no files of this type