Javascript in VROOM

Javascript Files

Javascript Files are managed as Includes as they are snippets of code which may be included in a template. However accessing them requires you to link directly to them via a 'virtual path'.

First of all, you can create your Javascript in the Template menu of the administrator portal. Click Javascript from the menu, then Add Javascript, then create a reference with the extension (e.g. my-style.css), and then click Save Changes.

NOTE: With Javascript you must add the relevant extension (e.g. .css or .js), otherwise the system will think that the code is a regular Include.

Once you have created your CSS or Javascript you can include it as you would normally through HTML using the following path:

For CSS use: /css/REFERENCE.css For Javascript use: /js/REFERENCE.js

An example below is taken from a header include which references both CSS and Javascript:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>{page:title}</title>
    <link rel="stylesheet" type="text/css" href="/css/my-style.css" />
    <script type="text/javascript" src="/js/my-javascript.js"></script>
</head>
<body>
<!-- end header -->