Scripts

JavaScript and JQuery

You may create or upload JavaScript files to the development/Scripts folder. You can configure to load the Script files in this folder on a page by page level. JQuery is included in the kooboo cms by default, so you do not need to upload JQuery package.

The loading of JavaScript files is very similiar to the loading of CSS files. Follow the steps below.

1. Create or upload JavaScript files to the development/Scripts folder.

Script

Create: create a JavaScript on the server using text editor. Import: Import a zip file that contains JavaScript files.

2. In the layouts that you would like JavaScript files to be loaded, add the following code to it.

Script_register


3 options to control the loading of JavaScript

The loading of JavaScript is controlled in 3 different places. 

- page setting

This is used to determine whether the JavaScript from the Scripts folder under development will be loaded or not.  This is not about the system built-in Jquery library. This option is enabled by default. 

Script_load_on_page



- System settings

There is a system setting to determine whether to load Jquery script or not.  This setting is enabled by default. 

jquery_system_setting.png


Please note that the JQuery stylesheet is loaded together with the theme feature.



-  RegisterScripts()


 @Html.FrontHtml().RegisterScripts() is used to register Scripts into one page. Without this registration in the page layout or view, none of above scripts will be loaded into the page.