我有一个颜色框,让用户选择一个图像.如何从彩盒中取回文件名? (我注意到了onClosed函数.)
解:
由于@Gummy sugested我使用了onComplete函数,因为以下代码举例说明:
‘返回’页面:
Box_hidden_return" type="hidden"/>
...
$("#whatever-you-want-to-click-on-to-get-the-color-Box").click(function() {
$.colorBox(
{
href: '= site_url('the-source-url') . '/' ?>' + id,height: "600px;",onClosed: function() { // called when the colorBox closes
var image = $('#colorBox_return_hidden').val();
// ... other processing - what ever the value was is in image
}
});
});
在彩盒源中
var image_name_var = "dynamicaly_change_this_name.png";
$('#submit-or-use-button-id').click(function() {
$('#colorBox_return_hidden').val(image_name_var);
});
最佳答案