Development With Custom JS

This folder contains a single JavaScript file. It is important to adhere to the folder and file naming conventions strictly.

To add custom scripting to the template webpage, we need to add a file named config.js in this folder. We can write JavaScript code in this file to customise the webpage behaviour as per our requirements.

Here’s an example of using custom JS:

This is a ‘Go to Top’ button. We have created this button using an HTML widget and assigned it the class ‘.goToTop’. To implement its functionality, we need to add custom JavaScript code to the ‘config.js’ file. Below is the JavaScript code.

  • JavaScript
// GO TO TOP DESIGN
$(function(){
        $(".goToTop").click(function(){
            $('html, body').animate({
                scrollTop: $("body").offset().top
            }, 1000);
            return false;
        });
    }
});

Leave a Reply

Your email address will not be published. Required fields are marked *