Getting handle values

manuman94 edited this page May 7, 2014 · 7 revisions

Getting handle values

The ytCropper library has methods to obtain the handle values. The library has also one method that returns a embed YouTube video link prepared to play the interval specified in the cropper.

  • ytCropper::getInitialValue()
    Returns the first handle value in seconds (the first interval value).

  • ytCropper::getFinalValue()
    Returns the second handle value in seconds (the last interval value).

Example:

$("#generateButton").on("click",function(e)
{
        // Prevent the default behaviour of <a> tag
    e.preventDefault();
        // Obtain the first value and put it into #firstInput
    $("#firstInput").val(cropper.getInitialValue());
        // Obtain the first value and put it into #secondInput
    $("#secondInput").val(cropper.getFinalValue());
        // Obtain the embed link and put it into #generatedCode
    $("#generatedCode").val(cropper.getEmbedLink());
});

This code means that, when the generateButton is pressed, changes the #firstInput, #secondInput and #generatedCode with the first handle value, second handle value and embed YouTube link.

You can test it here: http://jsfiddle.net/BxQhy/19/

More information about this plugin on this wiki.