我正在使用swfupload插件(http://demo.swfupload.org/Documentation/)上传多个文件。我定义了以下swfupload设置对象。一切都工作正常,但光标不会变为'手'形式。这是代码:
var initialize_swfupload_for_image = function () {
if ($('#image-attach').length == 0){
return;
}
var url = $('#image-attach').data('url');
var params = $('#image-attach').data('params');
var buttonStyle = '.image-link {color: #FFF' +
';text-align: center'+
';} ' +
'.image-link:hover {color: #0FF' +
';} ';
var settings = {
upload_url:url,
flash_url: "<%= asset_path('swfupload/swfupload.swf') %>",
flash9_url: "<%= asset_path('swfupload/swfupload_fp9.swf') %>",
http_success:[ 200, 201, 204 ],
file_post_name:"file",
file_types: "*.jpg; *.gif; *.png; *.jpeg",
file_upload_limit:1,
file_queue_limit:0,
file_size_limit:"10 MB",
prevent_swf_caching:false,
custom_settings:{
progressTarget:"divImageProgressContainer",
cancelButtonId:"btnImageCancel"
},
button_placeholder_id:"image-attach",
button_text: "<span class='image-link'>Edit Photo</span>",
button_text_style: buttonStyle,
button_width: 90,
button_height: 20,
button_cursor:SWFUpload.CURSOR.HAND,
button_window_mode:SWFUpload.WINDOW_MODE.TRANSPARENT,
button_action:SWFUpload.BUTTON_ACTION.SELECT_FILE,
file_queued_handler:fileQueued,
file_queue_error_handler:fileQueueError,
file_dialog_complete_handler:fileDialogComplete,
upload_start_handler:uploadStartImage,
upload_error_handler:uploadError,
upload_progress_handler:uploadProgressImage,
upload_success_handler:uploadSuccessImage,
upload_complete_handler:uploadCompleteImage,
queue_complete_handler:uploadCompleteImage,
post_params:params
};
if (FlashDetect.versionAtLeast(9)) {
swf_image = new SWFUpload(settings);
} else {
//intentionally left blank
//TODO: javascript fallback when swfupload doesn't work
}
关于光标在悬停在对象上时没有改变的原因的任何见解都会非常有用。
答案 0 :(得分:1)
我遇到过同样的问题。就我而言,罪魁祸首是我在button_width
和button_height
属性中意外添加的'px':button_width: "20px"
。
您的问题显然不是同一个问题,但可能与您可能已将无效值传递给SWFUpload有关。
我复制了你的代码,在从自定义的东西清理后,我可以毫不费力地显示手(甚至没有改变任何东西)。这是使用swfupload.swf 2.2.0.1和swfupload.js 2.2.0 2009-03-25测试的代码(请注意,swfupload.swf和swfupload.js与html文件位于同一文件夹中):
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>index</title>
<script type="text/javascript" src="swfupload.js"></script>
<script type="text/javascript" charset="utf-8">
var init = function () {
var settings = {
upload_url:'url',
flash_url: "swfupload.swf",
http_success:[ 200, 201, 204 ],
file_post_name:"file",
file_types: "*.jpg; *.gif; *.png; *.jpeg",
file_upload_limit:1,
file_queue_limit:0,
file_size_limit:"10 MB",
prevent_swf_caching:false,
custom_settings:{
progressTarget:"divImageProgressContainer",
cancelButtonId:"btnImageCancel"
},
button_placeholder_id:"image-attach",
button_text: "<span class='image-link'>Edit Photo</span>",
button_width: 90,
button_height: 20,
button_cursor:SWFUpload.CURSOR.HAND,
button_window_mode:SWFUpload.WINDOW_MODE.TRANSPARENT,
button_action:SWFUpload.BUTTON_ACTION.SELECT_FILE,
};
swf_image = new SWFUpload(settings);
}
</script>
</head>
<body id="index" onload="init()">
<div style="width:100px;height:100px;background-color:blue">
<div id="image-attach"></div>
</div>
</body>
</html>
我的猜测仍然是SWFUpload可能不喜欢其中一个参数(例如<%asset
内容)。希望这无论如何都有帮助。