I
I
iamsaint2012-02-03 16:16:58
JavaScript
iamsaint, 2012-02-03 16:16:58

jQuery. Part of an image?

Good afternoon.
Can you please tell me how to get part of the image using jquery
and display it on the page as a separate element?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2012-02-03
Protko @Fesor

var img = $('img.your').clone();
var block = $('<div/>, {
'style': 'display:inline-block;width:40px;height:40px;overflow:hidden;'
}).append(img);
$('body').append(block);

A
Anatoly, 2012-02-03
@taliban

var img = $(').attr('src', 'crop_img.php?file=img_name.jpg&x=20&y=38&width=48&height=66');
$('#img_container').append(img);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question