5 html javascript php jquery lightbox2
我实现了上传的图像显示在网站上.对于未正确上传的图像,意味着我更换了错误图像?当我加载网站时,我正面临着这个问题error image not
define,而且灯箱正在加载chrome和firefox,但它没有加载到IE中,只显示黑色背景.这是我的代码,用于显示错误图像和从Web服务上传图像.
PHP代码:
foreach(object_2_array($ans->answerDocumentList) as $document){
if ($document->documentHttpUrl!= ''):
$document_name_explode = explode('.',$document->documentName);
$file_type = trim($document_name_explode[1]);?>
<div class="documentation_class" <?php if($k%2==0){?> style="float:none;margin-left:0px;" <?php }else{ ?> style="float:left;"<?php } ?>>
<?php if(($file_type!="") &&($file_type=="png" || $file_type=="jpg" || $file_type=="jpeg" || $file_type=="gif")){ ?>
<a rel="lightbox[document]" href="<?php echo stripcslashes($document->documentHttpUrl); ?>">
<img alt="<?php echo stripcslashes($document->documentName); ?>" src="<?php echo APP_FORUM_URL;?>/images/ajax-load.gif" dataimage="<?php echo stripcslashes($document->documentHttpUrl); ?>" class="document_image" style="max-width:644px !important;" onerror='errorImage("<?php echo RESOURCE_URL_BASE;?>",this);' border="0" />
</a>
<br/>
<?php } else{
echo $document->documentName;
} ?>
<div class="question_float_left download_link">
<a href="<?php echo stripcslashes($document->documentHttpUrl); ?>">Click here to download this file</a>
</div>
<?php endif; ?>
<input type="hidden" value="<?php echo $document->documentId; ?>" class="list_document_id"/>
<input type="hidden" value="<?php echo $document->documentName; ?>" class="list_document_title"/>
</div>
<?php $k++; }?>
<script>
Run Code Online (Sandbox Code Playgroud)
功能是:
function errorImage(url,ctrl){
ctrl.style.border='solid 1px black';
ctrl.src='<?php echo APP_FORUM_URL; ?>images/broken-image.jpg';
$(ctrl).parent().parent().find('.download_link').hide();
}
Run Code Online (Sandbox Code Playgroud)
小智 1
最后我解决了我的问题,我让 Lightbox 在 IE 7 和 IE 8 上都能工作,
我包括脚本文件 google api http://www.google.com/jsapi和 google.load("jquery", "1"); google.load("jquery", "1");
在 Header.php 中,这是与我的 lighbox.js 文件和其他库文件冲突的问题,然后我删除了该脚本并添加了新的脚本 Js 库https://ajax.googleapis.com/ajax/libs/jquery/1.8。 1/jquery.min.js
我将所有脚本 $ 符号更改为 jQuery 现在我使 Lightbox 在 IE 浏览器和所有浏览器中都能工作
| 归档时间: |
|
| 查看次数: |
249 次 |
| 最近记录: |