Every time I have an issue with code I turn straight to codepen to make a small demo to concentrate on only the parts that will affect the problem. If it is JS then I add the minimum HTML and then work through the issue in the JS window, same if it is with CSS. I love it.