Loading in-js/jquery feature implementation

Source: Internet
Author: User

Objective

Recently in the SPRINGMVC integration of a JSP-based reporting tool, after integration, due to the large number of report calculations, SQL statements more complex, so the foreground click button Trigger, after a few seconds to react to pop up the report box, so want to join a similar loading in a good hint, so that the customer experience better , but not as easy as it is, the main product used by the Freemarker template engine, loading the encapsulated dialog method can not directly access the page and can not directly to the page and so on, but the problem is I one by one solved, nonsense not to say, directly into the topic, mainly to see the simple implementation of this small function.

Introduce the following HTML element
<body><div style= "width:100%!important;height:850px;text-align:center;" ><div id= "Loading" style= "margin-top:200px;" ><p><br/><font style= " Height:30px;vartical-algin:center;padding-left:5px "> is in the statistics, please wait a moment ......</font></p></div>< iframe id= "Reportiframe" src= "" frameborder= "no" border= "0" marginwidth= "0" marginheight= "0" scrolling= "yes" width= " 100% "height=" 100% "></iframe></div></body>


Of course, mine is based on the components encapsulated in this project, you can not need the outer div or do not need to directly limit the height and so on.

Js/jquery Key Code
$ (function () {var frameurl= "The path of the page to load in frame"; $ ("#reportIframe"). attr ("src", Frameurl); $ ("#reportIframe"). Load ( function () {//jquery control ' load ' div does not display $ ("#loading"). CSS ("display", "none");});

Effect

Postscript

If you carefully read, it is, is not perfect, waiting for the words and pictures should be floating in the content of the IFRAME is good, so that the IFRAME loading over the process and "loading" the words and pictures too much is very moderate, and then "loading" The words and pictures can be positioned directly in the center of the pop-up box instead of using margin,padding and other styles to locate otherwise different resolutions, may not be the same.

The above shortcomings really need to improve, because I have limited time and energy, the project is tight, so no longer pursue the higher quality of the function, if you are reading the article, have the time to have the ability to study out, very welcome to your message to answer, so you, me, and we have common progress and learning!

Loading in-js/jquery feature implementation

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.