• Resolved hsntgm

    (@hsntgm)


    Hello codepeople !

    I have lots of small html script in cff. Could i merge them in 1 external js file and enqueue to wordpress.

    Which structure ans syntax do i have to use for this external js file?

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello,

    You simply should includes all the code into the JS file (without the <script></script> tags), and upload it to the “/wp-content/plugins/calculated-fields-form/js/fields-public” directory in your web server, and the plugin will includes it automatically.

    To allow the changes take effect, go to the settings page of the plugin, untick the checkbox: “Activate Javascript Cache” and press the “Update” button.

    If you are defining functions to be used in a global scope, for example:

    function the_function_name()
    {
    /* The function code */
    }

    You should define them as follows:

    window[ 'the_function_name' ] = function()
    {
    /* The function code */
    };

    and that’s all.
    Best regards.

    Thread Starter hsntgm

    (@hsntgm)

    Thanks for solution codepeople it is nearly done expect my all offset codes broken.

    
    jQuery(document).on(
    'click', 
    '[id*="fieldname155_"]', function(){
    jQuery(window).scrollTop(jQuery('[id*="fieldname66_"]').offset().top);
    });
    

    Thanks.

    Edit:

    I hope this will solve problem.I try it.
    fieldname -find and replace- fieldname’+’

    Edit2: Not solved.

    • This reply was modified 7 years, 10 months ago by hsntgm.
    • This reply was modified 7 years, 10 months ago by hsntgm.
    Plugin Author codepeople

    (@codepeople)

    Hello,

    The code seems correct, however without the link to the webpage I cannot check it in action.

    Best regards.

    Thread Starter hsntgm

    (@hsntgm)

    Thanks,

    Code working internally but with external js doesn’t work.

    link

    Thread Starter hsntgm

    (@hsntgm)

    Ok I found the issue.My some buttons are calculate and some of them are regular button.The scroll function works on calculate buttons but not working with regular buttons if i use external js.Internally they all are working.

    I found the issue but why don’t trigger this function for calculate buttons i did not fixed it.Now i will go back my backup.I will use my internal scripts.

    Best Regards.

    Plugin Author codepeople

    (@codepeople)

    Hello,

    I’m sorry, but your form is so complex, that I cannot check all its logic and code, however, be sure the fields to use as reference for scrolling are visible when you call their “offset()”

    Best regards.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to merge cff HTML scripts to 1 external js file’ is closed to new replies.