1
我正在使用断头台插件;jQuert断头台插件 - 在哪里设置高度和宽度
的jQuery插件铡V1.3.1 http://matiasgagliano.github.com/guillotine/
我演示的代码测试,但试图设置宽度和高度。无论我在哪里设置宽度和高度,getData方法都会失败。如果我删除的宽度和高度声明(默认为400×300像素)的getData工作再次和你点击缩放等
<script type='text/javascript'>
jQuery(function() {
var picture = $('#memberPhoto');
//SETTING THE WIDTH AND HEIGHT CAUSES GETDATA() TO STOP WORKING
//THE CONTROL PANEL DOES NOT UPDATE AND THE OUTPUT OF GETDATA IS EMPTY
//picture.guillotine({width: 250, height: 300});
// Make sure the image is completely loaded before calling the plugin
picture.one('load', function(){
// Initialize plugin (with custom event)
picture.guillotine({eventOnChange: 'guillotinechange'});
picture.guillotine('fit')
// Display inital data
var data = picture.guillotine('getData');
for(var key in data) { $('#'+key).html(data[key]); }
// Bind button actions
$('#rotate_left').click(function(){ picture.guillotine('rotateLeft'); });
$('#rotate_right').click(function(){ picture.guillotine('rotateRight'); });
$('#fit').click(function(){ picture.guillotine('fit'); });
$('#zoom_in').click(function(){ picture.guillotine('zoomIn'); });
$('#zoom_out').click(function(){ picture.guillotine('zoomOut'); });
// Update data on change
picture.on('guillotinechange', function(ev, data, action) {
data.scale = parseFloat(data.scale.toFixed(4));
for(var k in data) { $('#'+k).html(data[k]); }
console.log(data);
});
});
// Make sure the 'load' event is triggered at least once (for cached images)
if (picture.prop('complete')) picture.trigger('load')
});
如果我设置的高度和直接宽度控制面板更新在源代码中一切都很好。 任何人都可以帮忙..?那你有
感谢 罗尔夫
当您运行此脚本,你得到开发人员控制台中的任何不确定的错误? –
根本没有错误......一切仍然有效..我可以调整大小,旋转等,但没有给予数据对象的值。 –
我刚下载演示。我会看一看,看看我能不能找出一些东西。 –