JavaScript
For the broadest functionality and developer ease, Shadows ships with jQuery. The much of the JavaScript used in Shadows is "vanilla" in nature. We have found this to perform well and work cross-browser.
While you can create and call JavaScript function using the familiar $('#some_ID')
or $('.some_CLASS')
way, the preferred way in Elements is to
use a data attribute called hook, $.hook('some_data_hook')
.
Using data-hook
allows for having multiple possible elements,
like when using a class
.
data-hook
on an element to be called by your function.
Use it in your JavaScript
Although the core of Elements may not be updated often, it is recommended that all theme based
functionality be added to the THEME_NAME/ui/js/theme.js
file
within the proper page function call.