Skip to content

Instantly share code, notes, and snippets.

@teomanofficial
Last active January 22, 2020 14:28
Show Gist options
  • Save teomanofficial/dbf8db478c4768d53cbcccb0aac115fa to your computer and use it in GitHub Desktop.
Save teomanofficial/dbf8db478c4768d53cbcccb0aac115fa to your computer and use it in GitHub Desktop.
// fixed width and height
$('#banner').cropper({
movable: false,
resizable: false,
rotatable: false,
dragCrop: false,
dragMode: 'move',
cropBoxResizable: false,
responsive: true,
// viewMode: 1,
ready: function () {
width = document.getElementById('banner').width;
heigth = document.getElementById('banner').height;
var cropheigth = 350;
if (width => 1400) {
cropheigth = width * 4 / 16;
if (cropheigth <= 350) {
cropheigth = 350
}
}
$('#banner').cropper('setData', {
height: cropheigth,
width: width,
});
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment