S
S
Stone-Studio2015-10-16 19:54:33
JavaScript
Stone-Studio, 2015-10-16 19:54:33

How to make the frame resize in real time?

fotooboikin.ru/neboskrebyi

Now the frame appears if you enter the size in the fields (width/height) and drag the mouse over the picture. How to make it so that when entering into the form, the size of the selected area immediately changes (and it was not necessary to hold the mouse for this). The imgSelectArea plugin is used.
odyniec.net/projects/imgareaselect

$(document).ready(function () {

    var height = 0;
    var width = 0;

    var img_width = 0;
    var img_height = 0;

    var min_width = 0;
    var min_height = 0;

    var timer = $.timer(function() {

        height = $('input[name="height"]').val();
        width = $('input[name="width"]').val();

        coaf_get = $('select option:selected').val();
        kachestvo_get = $('input[name=browser]:checked').val();
        add_get = $('input[name=browse]:checked').val();

        img_width = $('.img-posts').width();
        img_height = $('.img-posts').height();

        ****************
        расчет цены
        ***************

        min_height = img_height;
        min_width = img_width;

        if(width > height)
            min_width = img_width;

        if(height > width)
            min_height = img_height;

        if(height == '' || width == '') {
            //alert('Введите высоту и ширину')
        } else {

            $('.img-posts').imgAreaSelect({
                aspectRatio: width + ':' + height,
                handles: true,
                parent: '.kart',
                show: true,
                minWidth: min_width,
                minHeight: min_height,
                keys: true
            });

        }

    });

    timer.set({ time : 1000 });

    timer.play();

});


As a result, you need to implement it like this:
www.fotooboi4you.ru/masterskaya/4144
(note that when you enter the width and height, the frame sizes change automatically)

PS I'm interested in what to do after the change event. How to rigidly set the size and location of the frame?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Everal, 2015-10-16
@Everal

eventcharge
https://api.jquery.com/change/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question