
| Line: 1 to 1 | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Added: | |||||||||||||||||||||
| > > | Behaviour Javascript framework ContribThis contrib packages the third-partyBehaviour Javascript event library, available from http://bennolan.com/behaviour/.
Behaviour is suited to create javascript based interaction that degrades well when javascript is not available.
Javascript file: behaviour.js (8.1K). The compressed javascript file (2.9K) has been processed by ShrinkSafe.
On this page:
IntroductionFrom the website:After all the work of WASP and others to promote clean markup, valid pages and graceful degradation via css - it sucks that we're going back to tag soup days by throwing javascript tags into our html. The better way to do javascript is to do it unobtrusively. PPK and Simon Willison have been recommending this approach for ages. And it's definitely the way to go. The only problem is that it's a bit of a pain in the ass. That's why I came up with Behaviour - my solution to unobtrusive javascript behaviours. How does it work? Behaviour lets you use CSS selectors to specify elements to add javascript events to. This means that instead of writing: UsageInclude the javascript file:In your code you create a "rules" object, with sub-objects for each html element class name or id:<script type="text/javascript" src="%PUBURL%/%TWIKIWEB%/BehaviourContrib/behaviour.compressed.js"></script> Apply the rules with: Behaviour.register(myrules); ExampleIf we have a 'normal' link to TWiki Web hometopic: TWiki Web Home, we can use javascript to make it open a popup window. When javascript is not available the link behaviour defaults to opening the page in the current window.Creates: TWiki Web Home Development
LicenseBehaviour is freely distributable under the terms of an BSD license. For details, see the Behaviour website.LinksContrib Info
| ||||||||||||||||||||