1

I am having trouble figuring out what is causing the click event to fire more than once in the webapp below. Please visit the url, click on any level [from Ground - 4], and then click on a unit.

http://plaza.foxqa.com.au/touch/index.html

That will bring up the Unit Details [price, images etc.]. The images in this page has a click event attached to them which basically enlarges the image. This event keeps stacking up. It will work fine when a unit is clicked for the first time.

Then it will fire twice for the second unit and three times for the third unit and so on. I tried to unbind the click event once the enlarged view is closed but still not working.

Any help would be appreciated.

Edit: Please test this in Google Chrome.

Edit 2: Steps that might help you figure out the problem sooner.

  1. Open the components_draft.js in your console.
  2. Add a breakpoint at line 687.
  3. Click on a level on the building
  4. Click on any green coloured unit [or lot].
  5. Once the unit details are displayed, click on the unit plan image.
  6. It gets enlarged.
  7. Click anywhere on the image and it will be minimized.
  8. Go back to step 4 by clicking the close icon.
  9. Repeat 5,6,7.
  10. Now, when the enalrged image is clicked, step through the functions in the console and you will see the click event looping twice for a single click.

I know following all of this is a pain but please take some time to analyze it.

4
  • 2
    Please post the relevant code here (remember: SSCCE) in order to prevent the question becoming useless/uninformative in the future, once the issue is resolved. Also, if possible, and if you feel it might help, consider posting a live demo at a site such as JS Fiddle, JS Bin, or similar, in order that we can see that code in action and follow it through its execution/application. Commented Jun 21, 2012 at 10:49
  • @David Thomas, The code is pretty long and it will not make any sense unless the person sees what it is doing. I dont have any problem pasting it here or providing a demo but it just wont work. Its more of a visual thing. Commented Jun 21, 2012 at 10:54
  • 1
    The code is pretty long, that is why you should specify related parts of it. Fellow engineers trying to answer this question should not spend time finding the event. Moreover, that answer should remain after you finish your project or shut down your domain. Commented Jun 21, 2012 at 10:59
  • Very true but i am not sure how i can break all that code up and explain it. I'll try my best. Commented Jun 21, 2012 at 11:03

2 Answers 2

2

please look again at your application.

there are some errors(JavaScript coding errors) that you can see in firebug console.

Sign up to request clarification or add additional context in comments.

1 Comment

My mistake. It is making a cross-domain Ajax request and it is only working in chrome. I should have mentioned it. For some reason it is not working in Firefox event hough the 'Access-Control-Allow-Origin' header is set on the server. But that is not of concern. The target is Chrome.
0

Found the bug. If anyone comes across this situation where the jQuery click events are building up over time, the most likely culprit is the

jQuery.live()

Its doesn't need to be nested under other click events.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.