This repository was archived by the owner on Apr 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
xurion edited this page Feb 24, 2013
·
1 revision
Wrap all occurrences of the word "CSS" in the entire page with the default acronym element.
var body = document.body,
acron = new Acronymizer({
element: body,
pattern: 'CSS'
});
acron.go();
Change the default wrapper to an anchor element and set the href attribute.
var body = document.body,
acron = new Acronymizer({
element: body,
pattern: 'CSS',
wrapper: 'a',
attributes: {
href: 'http://www.w3schools.com/css'
}
});
acron.go();
You can build Acronymizer with some setter functions available.
var acron = new Acronymizer();
acron.setElement(document.body);
acron.setPattern('CSS');
acron.setWrapper('a');
acron.setAttribute('a', 'http://www.w3schools.com/css');
acron.go();
Various events are available to hook into. Here is the beforeWrap event.
var acron = new Acronymizer();
acron.setElement(document.body);
acron.setPattern('CSS');
acron.setWrapper('a');
acron.setEvent('beforeWrap', function (text, wrapper) {
wrapper.href = 'http://www.w3schools.com/css';
wrapper.target = '_blank';
});
acron.go();
For more events, see documentation.