Solve the problem that the animated GIF picture can't work correctly in IE

Source: Internet
Author: User

IE and firfox are more or less different in many places, which leads to a lot of special situations to consider when developing. In a recent project, it was found that animated GIF images were not displayed in a script-controlled manner after page load. In my project, you need to click a button and then display a dynamic loading picture to indicate that the program is in the background processing. This is done through a piece of jquery code:

01 <font face="Calibri" size="3">function showMessage() {
02         ......
03         $("div#Processing").show();
04         ......
05     }
06
07 <div id="Processing" style="display: none">
08     <center>
09         
10     </center>
11 </div></font>

IE shows the picture, but the animation does not play. But in the Firfox is able to work normally. When you add the entire div to the DOM, the div is hidden and invisible. But when you set its properties to be visible, the animation cannot be played properly. If the animated GIF is added directly to the DOM in visible form, it can be true and animated. So, you can change the code like this:

01 <font face="Calibri" size="3"><script language="javascript" type="text/javascript">
02     function showMessage() {
03
04         $("div#Processing").show();
05         var imgSrc = '<%=ResolveUrl("~/Images/Checkout/placeOrder_processing.gif") %>';
06         $("td#imgSection").append(" 07
08     }
09
10 </script></font>

1 <font face= "Calibri" size= "3" > in this way, adding IMG to the DOM in the visible content can solve the problem. </font>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.