javascript - Jquery Jqui Modal Window: opening same modal multiple times -
I am working on a JavaScript function which opens a jquery modal window and populates the model for an Ajax call. It makes me add the 'left' and 'right' divi id - clicking on one and changing the contents of the modal window (scrolling through the photo slideshow).
Everything works great except for one task: if I switch the modal and then turn it off, because of opening this second time, the reason for these 'left / right' buttons to calculate each click twice (Once click on 'right', but move two images up). If I close the window and open it again, the count again increases by 1 (3 changes for 1 click)
The only solution to decide is to reload the page when the modal window is closed - but is anyone aware of a better solution? Actually, I want to 'reset' the modal window, but I do not want to delete it - I want to be able to open / close the model several times and this right / left button works.
function getNextImage (direction) {if (direction == 1} {i (imageNumber == 1) {imageNumber = lastImage;} and {--imageNumber ;}} If (direction == 2) {if (imageNumber == last image) {imageNumber = 1;} and {++ imageNumber;}} if (direction == 0) {imageNumber = 1;} $ .ajax ( {Type: "GET", url: "phpIncludes / next_fetch.php", cache: incorrect, data: {img: imageNumber, cap: image number, width: dWidth, height: dHeight, a: album}, success: function html () ($ ("# left" + album). html (htmlpic);}};} $ ("# MoveLeft" + album). Click (function () {getNextImage (1); console.log (" Image number is: "+ imageNumber";}); $ ("# MoveRight" + album). Click (function Not () {getNextImage (2) console.log ("image number:" + imageNumber);});
$. Ajax ({type: "GET", url: "phpIncludes / next_fetch.php", cache: incorrect, data: {img: imageNumber, cap: imageNumber, width: dWidth, height: dHeight, a: album}, success: function (htmlpic) {$ ("#left" + album). Html (htmlpic);}});
Before you add #left to htmlpic, proib leave this content empty first # !!
Comments
Post a Comment