- Parameters of jQuery function
- Loading the jQuery library and its extensions
jQuery (Function) In french: jQuery Runs a JavaScript method (or several chained methods) of the jQuery library on a page element. This function is an advanced feature: a good knowledge of JavaScript and jQuery library is required.
// A single jQuery function is used jQuery(STC_1).fadeOut()
// Use with 2 chained functions // The opacity of control is modified, then the control explodes before it disappears jQuery(CELL_Square).fadeTo("opacity",0.1).effect("explode")
Syntax
Running a command of jQuery library Hide the details
<Result> = jQuery(<WEBDEV control>).<jQuery function>(<Parameter 1>, ..., <Parameter N>)
<Result>: Expected type Return value of jQuery method called. <WEBDEV control>: Control name Name of control that will be used in the page. Remark: The option "The control can be overlaid" must be checked for the control ("UI" tab in the control description window). <jQuery function>: Character string Name of jQuery function to run. Caution: JavaScript being case sensitive, the function name must respect the case used in the jQuery library. <Parameter 1>: Character string First parameter expected by the jQuery function. <Parameter N>: Character string Nth parameter expected by the jQuery function.
Running several chained commands of jQuery library Hide the details
<Result> = jQuery(<WEBDEV control>).<jQuery function 1>(<Parameter 1>, ..., <Parameter N>).<jQuery function 2>(<Parameter 1>, ..., <Parameter N>)
<Result>: Expected type Return value of jQuery method called. <WEBDEV control>: Control name Name of control that will be used in the page. <jQuery function 1>: Character string Name of first jQuery function to run. Caution: JavaScript being case sensitive, the function name must respect the case used in the jQuery library. <Parameter 1>: Character string First parameter expected by the jQuery function. <Parameter N>: Character string Nth parameter expected by the jQuery function. <jQuery function 2>: Name of second jQuery function to run. Caution: JavaScript being case sensitive, the function name must respect the case used in the jQuery library. Remarks Parameters of jQuery function If a procedure ("Callback") must be passed to one of the jQuery functions, the browser procedure must be passed by reference (function name preceded by "&"). For example:
jQuery(BTN_Add).on("click", &OnAddition)
Loading the jQuery library and its extensions A jQuery library is provided with WEBDEV but you have to include another library in replacement or include extensions (jQuery-UI for example). You can: - include the local or remote script (recommended method).
- use the "<script src = ...> tag.
Method 1: Including the script file (local or remote (URL)) (recommended method) - Display the description window of the page ("Description" in the context menu).
- Select the "Advanced" tab.
- Select the "External resources (JavaScript/CSS)" tab.
- To reference:
- a remote script, copy/paste the address (URL) of the script file into the "JavaScript resources" column.
- a local script (file found on your computer for example), click the "+" button of "JavaScript resources" and select the corresponding file.
Caution: Check the order of script dependencies (the jQuery library then its extensions). Method 2: Adding the tagging for script insertion: - Display the description window of the page ("Description" in the context menu).
- Select the "Advanced" tab.
- Select the "HTML" tab.
- Copy the following lines of code into the "HTML code added to the page header" section. For example:
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
Caution: - The code must be inserted into the "HTML code added to the page header" section and not into the "HTML code added at the end of page" section. Exception: If you want to include an extension without including another jQuery library, you must:
- Use the method that uses the tagging.
- Copy the code into the "HTML code added at the end of page" section.
- This method is not recommended because the script load interrupts the page load. The loading and the page display are slowed down.
|
|
|
|