What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Lightbox js optimization

    Asked by loradrien on April 25, 2011 at 04:43 AM

    Hello.

    First, sorry for my English.

    I'm using lightbox on the cover of my website, and all javascript, slow loading and rendering of the web.

    If jotform.com goes down, my site would not load.

    1. Is it possible to host https: / / www.jotform.com/min/g=feedback on my server?

    2. Can I use head.js? (http://headjs.com/)

    In header:

    <script src="/js/head.min.js"></script>

    Script:

    // the most simple case. load and execute single script without blocking.
    head.js("/path/to/file.js");
     
    // load a script and execute a function after it has been loaded
    head.js("/path/to/file.js", function() {

    });
     
    // load files in parallel but execute them in sequence
    head.js("file1.js", "file2.js", ... "fileN.js");
     
    // execute function after all scripts have been loaded
    head.js("file1.js", "file2.js", function() {

    });
     
    // files are loaded in parallel and executed in order they arrive
    head.js("file1.js");
    head.js("file2.js");
    head.js("file3.js");
     
    // the previous can also be written as
    head.js("file1.js").js("file1.js").js("file3.js");

    As applied to lightbox?

    <script src="//www.jotform.com/min/g=feedback" type="text/javascript">
    new JotformFeedback({
    formId:'xxxxxxxxxxxx',
    base:'http://www.jotform.com/',
    windowTitle:'xxxxxx',
    background:'#B8B8B8',
    fontColor:'#FFFFFF',
    type:1,
    height:500,
    width:700
    });
    </script>
    <a id="lightbox-xxxxxxxxxxxx" style="cursor:pointer;color:blue;text-decoration:underline;">xxxxxxxxxxxxx</a>

  • Profile Image

    Answered by loradrien on April 25, 2011 at 04:56 AM

    More examples:

    http://juev.info/2010/12/25/use-head-js/

  • Profile Image

    Answered by loradrien on April 25, 2011 at 12:05 PM

    someone help me?

  • Profile Image
    JotForm Support

    Answered by NeilVicente on April 25, 2011 at 03:35 PM

    Hi,

    I am not too familiar with how head js works, but with regards to your first question, yes it is possible to save http://www.jotform.com/min/g=feedback and have it hosted in your server instead. You would need to make modifications with your form's lightbox codes though.

    To save lightbox/feedback JavaScript:

    1.  Go to http://www.jotform.com/min/g=feedback using your browser

    2.  Press Ctrl + S on your keyboard to save the file as g=feedback.js  or any name, just be sure to use the same name on your lightbox embed codes

    3.  Upload this file in your server, take note of the folder where you upload the file

    4.  Modify your lightbox/feedback code to reflect the hosted g=feedback.js on your server.

    For Example:

    <script src="scripts/g=feedback.js">
    new JotformFeedback({
    formId:'xxxxxxxxxxxx',
    base:'http://www.jotform.com/',
    windowTitle:'xxxxxx',
    background:'#B8B8B8',
    fontColor:'#FFFFFF',
    type:1,
    height:500,
    width:700
    });
    </script>
    <a id="lightbox-xxxxxxxxxxxx" style="cursor:pointer;color:blue;text-decoration:underline;">xxxxxxxxxxxxx</a>

    5. Embed your form.

    The downside to this is that if there are any changes or updates made to Jotform's lightbox/feedback functions, those changes won't be reflected in your pages, because you're using your own hosted JavaScript file.

    You may take a look at this example page I have creating using self-hosted g=feedback.js

    Hope you find this helpful. Let us know if there's anything else we can assist you with.

    Regards,
    Neil

  • Profile Image

    Answered by loradrien on April 25, 2011 at 05:02 PM

    Thank you very much for responding. I will continue doing research on optimizing the Javascript load in my web.

    The other problem is that "g = feedback.js" has a size of 246kb, it would be possible to reduce it? I would appreciate it very much.

      If you could reduce the size, would be perfect. I love your lightbox because it is simple and need not add much code on the web.

    Best regards.

  • Profile Image
    JotForm Support

    Answered by abajan on April 25, 2011 at 09:30 PM

    Sorry to be off topic but is anyone else seeing the lower border of this thread flashing once per second? What on earth is causing that??