J
Jean-Philippe Encausse
Hi,
Behaviour is a really cool API mapping CSS style on JS function. This
remove ugly JavaScript functino declaration in HTML.
I would like to add a behaviour to a given html tag.
For exemple:
I have an Image <img src="path/to/image.png" class="toggle" /> and I
would like
to toggle url/class with an other on click event. So binding an onclick
event to do the toggle.
1# Where to put Event information ? -> toggleClick ? not really clean
2# Where to put target class ? -> target="newClass" ? doesn't work on
all tags.
3# Parsing custom information in StyleSheets ? complicated ...
The cleaner was would be to add dynamic attribute to an html tag using
Behaviour. Like A.attribute { element.SetAttribute("???" , "???") }
then
A.toggle { read the attributes and do the toggles } Where to find
attributes key/values ?
An other clean way would be to use custom css declaration ? But how to
do that in a crossbrowser way ?
So I don't know how to did that without writing ubgly mix of JavaScript
fuction with html or creating lots of class for one purpose.
Any Idea ?
Best Regards.
Behaviour is a really cool API mapping CSS style on JS function. This
remove ugly JavaScript functino declaration in HTML.
I would like to add a behaviour to a given html tag.
For exemple:
I have an Image <img src="path/to/image.png" class="toggle" /> and I
would like
to toggle url/class with an other on click event. So binding an onclick
event to do the toggle.
1# Where to put Event information ? -> toggleClick ? not really clean
2# Where to put target class ? -> target="newClass" ? doesn't work on
all tags.
3# Parsing custom information in StyleSheets ? complicated ...
The cleaner was would be to add dynamic attribute to an html tag using
Behaviour. Like A.attribute { element.SetAttribute("???" , "???") }
then
A.toggle { read the attributes and do the toggles } Where to find
attributes key/values ?
An other clean way would be to use custom css declaration ? But how to
do that in a crossbrowser way ?
So I don't know how to did that without writing ubgly mix of JavaScript
fuction with html or creating lots of class for one purpose.
Any Idea ?
Best Regards.