We help IT Professionals succeed at work.

HTML/Javascript glitch!

370 Views
Last Modified: 2012-06-27
Hi,

I think this one may be simple for someone who knows some JS:

I have an image on a web page, and a script that basically swaps a new image in whenever you drag the image either left or right, to make it look like the object in the image is spinning. Easier to see than to describe:

http://catamazing.com/eemodel/model_index.html

It works great, except that that in FireFox when you click and drag it "captures" the mouse, so when you unclick it keeps shifting the image, and when you drag the mouse out of bounds and back onto the image, and click  -- it snaps the image to a different spot. (If you just play with it for 2 seconds you will see what I mean).

This only happens in firefox, not in IE or Chrome.

I am wondering if anyone has a suggestion as to what the issue might be and how to fix?

All the code (JS/CSS/HTML) is in the source of the page.

Thank you very much in advance for any help!

Andrey
Comment
Watch Question

I've only taken a quick look - have time constraints atm.

I suggest you take it through the process I was just doing of running the code through JSLint, and perhaps Firefox + Firebug + (your choice of code auditing).

My experience has been when your code is clean, and no errors are popping up and a quirk occurs in only 1 or 2 browsers - run it through JSLint, and it leads to things behaving.

Author

Commented:
Thanks for the reply. I tried to use JSLint as you suggested -- it brought up a bunch of errors, but I am not sure what they mean/how to fix them. My JS knowledge is very limited. I didn't write this code, it was automatically generated by another program.

Andrey
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Figured it out.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.