1

In a multi page template,I have three category pages (comedy, action, drama) that you can swipe between each containing rows of images (Seinfeld, Modern Family, Family Guy, Big Bang). Clicking on an individual image should open a dialog box (Seinfeld summary), close when you click the close button, and stay close. Initially it works, then what happens is based on the number images click after two, it opens and closes n -1 (clicking the 3rd image, opens the dialog box twice).

what could be the reason behind this?

Gajotres
  • 57,309
  • 16
  • 102
  • 130
0--
  • 221
  • 1
  • 6
  • 16
  • Can you show as a part of your code? I think I know what is your problem but I want to be sure. Worst case scenario show as only part of your code where you bind a click event to the picture. – Gajotres Jan 26 '13 at 16:52

1 Answers1

0

Without your code I can be sure but I think I understand what is happening to you.

You have a problem with multiple event binding. Because of jQuery Mobile architecture it is possible to bind an event numerous time to some object.

I have an blog ARTICLE on jQuery Mobile page events handling and there's a chapter dedicated to this problem, just search for the chapter Prevent multiple event triggering. Or it can be found HERE.

In few words always unbind event before you bind it to some object to prevent this from happening:

$('#test-button').die('click').live('click', function(e) {
    alert('Button click');
});
Community
  • 1
  • 1
Gajotres
  • 57,309
  • 16
  • 102
  • 130