Matej Posted January 14, 2015 Share Posted January 14, 2015 (edited) Hello , i have this little thing hre http://jsfiddle.net/Trolstover/qxd32hkk/4/ , it works fine , but the problem is , when i click on the TD element first time , it works , but on other TD elements i have to click twice to make it work , can anyone help me with this Edited January 14, 2015 by Matej Link to comment Share on other sites More sharing options...
justsomeguy Posted January 14, 2015 Share Posted January 14, 2015 Start by addressing the Javascript errors that show up. Link to comment Share on other sites More sharing options...
Matej Posted January 14, 2015 Author Share Posted January 14, 2015 Cannot read property of "null" , it works fine when first click on last TD and go to the last one (clicking each one) ,i guess when error show up content ain't loaded yet or the variable are overwritting themselves (as i click on more of Td elements in a row in a random order) //which is strange , i guess i gotta use closures right? but i use em on "onclicK" function it doesnt change a thing Link to comment Share on other sites More sharing options...
justsomeguy Posted January 14, 2015 Share Posted January 14, 2015 It's probably removing the class that you're trying to find. Link to comment Share on other sites More sharing options...
Ingolme Posted January 14, 2015 Share Posted January 14, 2015 e.target is already pointing to the element with class .bodky at least some of the time, so there is no element .bodky inside it. Perhaps e.currentTarget, if not, then check the className of e.target and choose e.target.parentNode instead if the class if bodky. Link to comment Share on other sites More sharing options...
Matej Posted January 14, 2015 Author Share Posted January 14, 2015 (edited) e.target is already pointing to the element with class .bodky at least some of the time, so there is no element .bodky inside it. Perhaps e.currentTarget, if not, then check the className of e.target and choose e.target.parentNode instead if the class if bodky. e.currentTarget is working , thank you very much , but shouldnt e.target point to TD element all the time? i mean i used event.target just for querySelector = to get some element from element which triggered event = event.target , or am i wrong? // nevermind realized that Edited January 14, 2015 by Matej Link to comment Share on other sites More sharing options...
Ingolme Posted January 15, 2015 Share Posted January 15, 2015 e.target will sometimes point to the deepest element in tree, it's considered the element that the event occurred on. Link to comment Share on other sites More sharing options...
Matej Posted January 15, 2015 Author Share Posted January 15, 2015 (edited) One more question i fixed it here http://jsfiddle.net/Trolstover/qxd32hkk/13/, works fine , but there whenever you click on element while its still changing opacity something strange happen , it shows .hidden and .bodky at the same time even tho i specifed that function interval which change opacity should be invoked only when the .bodky opacity is equal = 0 or 1 , strange is that i had to if(decko.style.opacity="") even tho i have defined opacty of both .hidden and .bodky in the css. Edited January 15, 2015 by Matej Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now