ajax - DOM reloads when using Jquery drag and drop -


We are making an interactive story for our school project. But we get a problem, when you reach the stage where you have to build Lego-Man when you drag any part of the gray area, it resets the DOM, or refreshes it

Is anyone watching what is happening?

You can see "Game" on this link.

------ Sorry for no code !!! ----- I do not know which part I should post, and it is also not sure if it resets.

I see my DOM element redrawing, Win7 / Chrome, your code buried in pieces of AJX It takes a while to track down this for some time, but I think what is happening is that when you leave items successfully - it is also registered as a click event, and click on that page Event:

  // Level 2 handler $ ("# level-2"). Click (function () (if ($ (this) .hasClass ("active") {$ $ ("#level_holder") .Fedhat ("slow"); $ ("# loader"). FadeIn (); $ ("#content_holder") .load ('content / content-2.html'); $ ("#content_holder"). FadeIn (); $ ("#loader") .Fedot ();} and {swal ( {Title: "hov!", Lesson: "du scall claire level 1 foremost!", Type: "error", confirmation text: "OK"});}});  

To prevent further bubbles from this event, you can also try your drag-drop-worthy drop event in this section, to prevent click events to continue on the bubbles. Add some code for:

  Function handmade drops (Event, UI) {var SlotNumber = $ (this) .data ('number'); Var item number = ui.draggable.data ('number'); // HighwayDelen has said that I do Rare Corrects. If (slotNumber == item number) {ui.draggable.addClass ('true'); Ui.draggable.draggable ('Disabled'); $ (This). Dropable ('disabled'); Ui.draggable.position ({: $ (this), mine: 'left top', on: 'left top'}); Ui.draggable.draggable ('option', 'back', wrong); CorrectItems ++; } // Entletate F Dell er Playcoreket = 3 (total = 3), if on the load nästist side (right objects == 3) {$ ("#main") .load ('content / pieces-1 / piece-3 .html '); } Event.stopPropagation (); // & lt; - 'Click' event prevents firing, reloading your "page"}  

Here is a link to jQuery event handling:

then - summarize In, I think that when you drop an object successfully, it also closes the click event on the page which ends up redrawing the piece above, basically at the end of your handleItemDrop function Add event.stopPropagation () and see if it stops refreshing that DOM fragment In going (it's fresh again redo Fedot and Fedein).


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -