本文介绍了jQuery imgAreaSelect hide / show?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直试图隐藏并显示 imgAreaSelect
选择框,具体取决于是否选中了复选框。
I've been trying to hide and show the imgAreaSelect
selection box depending on whether a checkbox is checked or not.
我试过了:
var ias = $('#photo').imgAreaSelect({ instance: true });
ias.setOptions({ show: false });
但它似乎没有做任何事情。
but it doesn't seem to do anything.
我不得不诉诸:
$('div.imgareaselect-selection').hide();
$('div.imgareaselect-border1').hide();
$('div.imgareaselect-border2').hide();
$('div.imgareaselect-border3').hide();
$('div.imgareaselect-border4').hide();
$('div.imgareaselect-handle').hide();
$('div.imgareaselect-outer').hide();
但它看起来有点麻烦,我敢肯定必须有更好的方法。
but it seems a little cumbersome and I'm sure there must be a better way.
推荐答案
更改选项后需要更新实例 - 。虽然事实上,我不确定你是否应该使用{hide:true}或{show:false}。
You need to update the instance after you change the options - http://odyniec.net/projects/imgareaselect/usage.html#api-methods . Although in truth, I'm not sure if you should be using { hide: true } or {show: false}.
var ias = $('#photo').imgAreaSelect({ instance: true });
ias.setOptions({ hide: true });
ias.update();
这篇关于jQuery imgAreaSelect hide / show?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!