Associate
- Joined
- 11 Oct 2008
- Posts
- 268
Hi guys,
I have this little bit of JS code that I'm using to get my css active to work on smart phones.
Seems okay to me, but I am no JS expert. However JS lint is giving me a lot of warnings.
I know the spaces are nothing to worry about but I just wondered about the rest? It seems to me like var is at the top of the function? no?
I have this little bit of JS code that I'm using to get my css active to work on smart phones.
Code:
window.onload = function () {
var q = document.getElementsByClassName("quarter");
for(var i = 0; i < q.length; i++) {
q[i].addEventListener("touchstart", function(e) {
e.target.classList.add("isactive");
});
q[i].addEventListener("touchend", function(e) {
e.target.classList.remove("isactive");
});
}
};
Seems okay to me, but I am no JS expert. However JS lint is giving me a lot of warnings.
I know the spaces are nothing to worry about but I just wondered about the rest? It seems to me like var is at the top of the function? no?
