Note: You are currently viewing documentation for Moodle 2.6. Up-to-date documentation for the latest stable version of Moodle may be available here: Datalynx JavaScript, CSS.

Datalynx JavaScript, CSS: Difference between revisions

From MoodleDocs
(Created page with "{{Datalynx}} It is possible to add custom JavaScript and CSS code to a datalynx activity. == JavaScript == If you use JavaScript, make sure to choose appropriate selectors a...")
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:


== JavaScript ==
== JavaScript ==
If you use JavaScript, make sure to choose appropriate selectors and classes, in order to only target the specific view where the JS should be used. Also make sure to make a difference between editing mode and view mode of a view. In the following example, the edit view is detected via the presence of an input-tag, that is not present in view mode.
You can add custom JavaScript in "Manage -> JavaScript". If you use JavaScript, make sure to choose appropriate selectors and classes, in order to only target the specific view where the JS should be used. Also make sure to make a difference between editing mode and view mode of a view. In the following example, the edit view is detected via the presence of an input-tag, that is not present in view mode.
<code javascript>
<code javascript>


Line 15: Line 15:


</code>
</code>
=== Possibilities to add JS ===
* Direct input
* Link to external JavaScript
* Upload a JS file


== CSS ==
== CSS ==
Add custom CSS in "Manage -> CSS"
Add custom CSS in "Manage -> CSS"
=== Possibilities to add CSS ===
* Direct input
* Link to external JavaScript
* Upload a JS file

Latest revision as of 22:58, 4 May 2014

It is possible to add custom JavaScript and CSS code to a datalynx activity.

JavaScript

You can add custom JavaScript in "Manage -> JavaScript". If you use JavaScript, make sure to choose appropriate selectors and classes, in order to only target the specific view where the JS should be used. Also make sure to make a difference between editing mode and view mode of a view. In the following example, the edit view is detected via the presence of an input-tag, that is not present in view mode.

YUI().use('node', 'event', function(Y) { if(Y.one('.class_only_present_in_a_view') && Y.one('.sws input')){ function werteberechnen(){ var einzel = Y.all('.summeects');

                }

} });

Possibilities to add JS

  • Direct input
  • Link to external JavaScript
  • Upload a JS file

CSS

Add custom CSS in "Manage -> CSS"

Possibilities to add CSS

  • Direct input
  • Link to external JavaScript
  • Upload a JS file