[英]Trying to display image in guillotine.js with dynamic width & height. Working fine with fixed width & height
尝试在具有动态宽度和高度的 guillotine.js 中显示图像。 在固定宽度和高度下工作正常。
jQuery(function() {
var picture = $('#sample_picture');
// Make sure the image is completely loaded before calling the plugin
picture.one('load', function(){
// Initialize plugin (with custom event)
picture.guillotine({
var mysize = '<?php echo $size1 ; ?>';
switch(mysize) {
case '9x11':
width: 268,
height: 375,
break;
}
eventOnChange: 'guillotinechange'});
它在固定宽度和高度下工作正常
picture.guillotine({
width: 314,
height: 224,
}
eventOnChange: 'guillotinechange'});
注意:php 中的变量 $size1 已正确分配给 mysize。
帮我解决这个问题。 谢谢
你的工作方式不是很好,你可以了解identation
,然后了解编程语言是如何工作的。 后来看到你的开发问题,我尝试解决你的代码问题,我可以解决它,看到你修复了示例(有错误) ,我做到了。 我希望能帮助你
jQuery(function() {
let picture = $('#sample_picture');
// Make sure the image is completely loaded before calling the plugin
picture.one('load', ()=>{
// Initialize plugin (with custom event)
let mysize = '<?php echo $size1 ; ?>',
sizes={}
switch(mysize) {
case '9x11':
sizes={
width: 268,
height: 375,
}
break;
}
picture.guillotine(sizes
eventOnChange: 'guillotinechange'});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.