久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

顏色框在 IE 中無法正確加載

Colorbox not loading properly in IE(顏色框在 IE 中無法正確加載)
本文介紹了顏色框在 IE 中無法正確加載的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我找到了解決方案,但它不是最好的,所以我仍在尋找解決方案.請參閱我的回答了解我所做的事情.

I have found a solution but it is not the best so I am still looking for a solution. See my answer for what I have done.

更新 - 我的錯誤仍然存??在,如下所述,但是如果我打開 IE 的開發者工具,錯誤就會消失!如果我關閉瀏覽器并重新打開,錯誤會再次出現!

UPDATE - My error persists as describe below BUT if I open IE's Developer Tools the error goes away! If I close the browser and re-open the error re-appears!

更新 2 - 我嘗試將以下代碼插入到我的 JS 中,看看是否能解決問題,但沒有:

UPDATE 2 - I have tried to insert the following code into my JS to see if that would solve the issue and it did not:

if (!("console" in window) || !("firebug" in console)) {
  var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
  window.console = {};
  for (var i = 0, len = names.length; i < len; ++i) {
    window.console[names[i]] = function(){};
  }
}

然后是這個:

var console = {};
console.log = function(){};

我還掃描了我的 JS 文件,但從未遇到會導致錯誤的 console.log 函數.

I also scanned through my JS files and never came across a console.log function that would be causing the error.

這是一個令人費解的問題,我會盡力解釋.我在第一次訪問時會顯示燈箱的頁面中設置 cookie.它在 FF、Chrome 等中運行良好,但在 IE 中則不行.

This is a convoluted issue and I will do my best to explain. I am setting cookies in a page that will show a lightbox on the first visit. It works great in FF, Chrome, etc. but does not in IE.

在 IE 中發生的情況是調用我的燈箱(顏色箱)觸發的腳本,但我看到的只是 AJAX 加載器旋轉并且內容永遠不會加載.我發現腳本啟動得太快了.我正在使用 $j(document).ready(function() 我切換到: $j(window).load(function() 一切似乎都很好它工作正常,直到我從另一個頁面開始并來到上面提到的頁面.

What happens in IE is the script for calling my lightbox (colorbox) fires but all I see is the AJAX Loader spinning and the content never loads. I figured out that the script was firing too soon. I was using $j(document).ready(function() I switched to: $j(window).load(function() and all seemed to be fine and it worked properly until I start from another page and come to the page mentioned above.

如果我從任何其他頁面開始并單擊鏈接,我也會遇到同樣的問題!cookie 工作正常,不會再次觸發該框.

If I start on any other page and click a link I have the same issue! The cookie works properly and does not fire the box a second time.

換句話說,如果我清除 cookie 并從有問題的頁面開始,那么沒有問題.但是如果我從任何其他頁面開始(清除了 cookie)并轉到上述頁面,顏色框將無法正確加載.

In other words if I clear cookies and start at the page with an issue then no issue. BUT if I start from any other page (with cookies cleared) and go to the above page the colorbox does not load properly.

據我所知,$j(window).load(function() 工作不正常.

From what I can tell the $j(window).load(function() is not working correctly.

我沒有收到來自 IE 的錯誤.我正在使用 IE 8 進行測試,并且無法在使用 Windows XP 時測試 9.(有人告訴我它在 IE 9 中運行良好,但尚未確認)該腳本位于我文檔的 <head> 中.(如果我將腳本移動到 <body> 它將完全破壞頁面.)

I receive no errors from IE. I am using IE 8 for testing and cannot test 9 as I am using Windows XP. (I have been told it works fine in IE 9 but have not confirmed this) The script is in the <head> of my document. (If I move the script into the <body> it completely breaks the page.)

我已經閱讀了 DOCTYPE 不正確或縮短的問題以及 IE 中的顏色框問題.我的 DOCTYPE 如下,應該是正確的:

I have read of issues of DOCTYPE not being correct or shortend and colorbox issues in IE. My DOCTYPE is as follow which should be correct:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

非常感謝任何想法或想法!

Any thoughts or ideas are greatly appreciated!

這是我正在使用的代碼:

Here is my code I am using:

Javascript

var $j = jQuery.noConflict();
$j(window).load(function() {
  //window.onload = function() does not function properly either...
  if(!$j.cookie('gallerycookie')){
    $j.colorbox({
      inline:true, 
      href:"#gallery-nav-instruct"
    });
    $j.cookie("gallerycookie", 1, {
      expires: 30, 
      path: '/'
    });
  }
});

HTML

<div style="display:none">
  <div id="gallery-nav-instruct">
    <h2>Gallery Navigation Instructions - Step 1</h2><h2 style="text-align:right">
      <a style="text-align:right;" class="inline cw" href="
         #gallery-enlarge-instruct">Step 2</a></h2>
    <p>&nbsp;</p>
    <p class="white"><img src="/Images/Pages/gallery-navigation.jpg" width="890" height="450" alt="Gallery Navigation Instructions" /></p>
  </div>
</div>

<div style="display:none">
  <div id="gallery-enlarge-instruct">
    <h2>Gallery Navigation Instructions - Step 2</h2>
    <p>&nbsp;</p>
    <h2><a class="inline cw" href="#gallery-nav-instruct">Step 1</a> </h2>
    <p class="white"><img src="/Images/Pages/gallery-enlarge.jpg" width="890" height="510" alt="Gallery -Enlarged View Instructions" /></p>
  </div>
</div>

另一個注意事項:我在頁面上使用 jAlbum,我沒有看到任何沖突,但可能有問題嗎?我無法在此處發布該代碼,因為它會超出 SO 的發布限制.

One other note: I am using jAlbum on the page and I do not see any conflicts but could there be an issue? I cannot post that code here as it would exceed the post limit for SO.

要從此頁面開始觸發此錯誤,將出現一個燈箱.點擊Message Examples(燈箱左下角或菜單中沒有燈箱的第一項).

To trigger this error start at this page, a lightbox will appear. Click Message Examples (lower left hand corner of lightbox or first item in menu without lightbox).

如果需要,這里是頁面的直接鏈接.(直接進入頁面不會觸發錯誤.)

Here is a direct link to the page if needed. (Going to the page directly will not trigger the error.)

我嘗試使用 window.onload = function() 并且發生了同樣的問題.

I attempted to use window.onload = function() and the same issue happened.

一旦加載了 div,我嘗試使用事件處理程序來觸發腳本,這甚至根本沒有觸發腳本.這是代碼:

I attempted to use the event handler to trigger the script once the div was loaded, that did not even fire the script at all. here was that code:

var $j = jQuery.noConflict();
$j('#gallery-nav-instruct').load(function() {
  if(!$j.cookie('gallerycookie')){
    $j.colorbox({
      inline:true, 
      href:"#gallery-nav-instruct"
    });
    $j.cookie("gallerycookie", 1, {
      expires: 30, 
      path: '/'
    });
  }
}); 

推薦答案

當你打開開發者工具時它消失的原因是 IE 不能很好地處理任何 console.log 語句,直到你打開開發者工具.某處必須有一個console.log.它可以在您正在使用的任何插件文件或 javascript 文件中.由于某種原因,它會殺死在它之后運行的 javascript.打開開發人員工具將 console.log 識別為 javascript 函數(我的最佳猜測),因此它突然起作用了.

The reason it goes away when you open developer tools is that IE does not play nice with any console.log statements, until you open the developer tools. There has to be a console.log somewhere. It could be in any plugin file or javascript file you're using. It kills javascript that runs after it for some reason. Opening developer tools recognizes the console.log as a javascript function (my best guess) and so it suddenly works.

這篇關于顏色框在 IE 中無法正確加載的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

jQuery/JavaScript Library for avatar creation?(用于創建頭像的 jQuery/JavaScript 庫?)
How to do following mask input problem?(如何做以下掩碼輸入問題?)
Issues Setting Value/Label Using DropKick Javascript(使用 DropKick Javascript 設置值/標簽的問題)
how to unit-test private methods in jquery plugins?(如何對 jquery 插件中的私有方法進行單元測試?)
stellar.js - configuring offsets / aligning elements for a vertical scrolling website?(stellar.js - 為垂直滾動網站配置偏移量/對齊元素?)
jQuery masked input plugin. select all content when textbox receives focus(jQuery 屏蔽輸入插件.當文本框獲得焦點時選擇所有內容)
主站蜘蛛池模板: 久久免费精品 | 精品一二三区在线观看 | 日韩欧美精品在线播放 | 欧美精品a∨在线观看不卡 国产精品久久国产精品 | 日韩不卡在线观看 | 精品无码久久久久久国产 | 日韩精品一区二区三区中文在线 | 亚洲欧美成人影院 | 337p日韩| 久久91| 亚洲精品久久久一区二区三区 | 激情福利视频 | 国产一级免费在线观看 | 涩涩操| 亚洲国产精品网站 | 国产在线h | 日韩色在线 | 国产成人99久久亚洲综合精品 | 欧美日韩亚洲在线 | 欧美区在线 | 免费人成在线观看网站 | 久久久久国产一区二区三区 | 日本在线播放一区二区 | 国产成人精品久久二区二区91 | 欧美xxxx黑人又粗又长 | 欧美精品免费观看二区 | 日韩国产精品一区二区三区 | 成人精品一区二区三区中文字幕 | 国产精品日韩欧美一区二区三区 | 久久极品| 亚洲中字在线 | 欧美成人精品一区二区三区 | a在线观看| 欧美成人自拍视频 | 91一区二区| 毛片一级电影 | 羞羞视频网站 | 精品国产乱码久久久久久丨区2区 | 国产中文字幕在线 | 亚洲高清视频一区 | 国产视频三区 |