Advanced Search

Results 1 to 2 of 2

Thread: double-firing lightwindow

  1. #1
    Join Date
    Jun 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default double-firing lightwindow

    I hope it's ok to post in here about lightwindow, since lightwindow's own forums have been down for a while... I've implemented it on a site and everything's running fine, except for one thing: When a user double-clicks on links with the "page" parameter (they also have width and height params), the script seems to fire twice resulting in a double-sized lightwindow with two stacked versions of identical content. This can be seen on this page.

    This problem is not occurring on non-"page" lightwindows. On other pages I have image-only lightwindows and gallery lightwindows. No problems there.

    I've looked into using JS to disable the link briefly after the first click, similar to form submission buttons, but I haven't found a workable solution. I also tried looking through lightwindow.js for something I could alter, but short of a glaring error in the code I'm not knowledgeable enough to find anything.

    Any ideas anyone has for tackling this issue would be greatly appreciated!

  2. #2
    Join Date
    Mar 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I realize this is way too late, but I stumbled across this posting while trying to find a solution to my problem, and ended up fixing it myself. Here was my solution, all changes are in lightwindow.js.

    near the top, i added a variable called currentlyFetching and default it to false

    Code:
    	windowActive : false,
            currentlyFetching : false,
    	dataEffects : [],
    then in the _loadWindow function, in the page: block about half way down the file, i wrapped the ajax call in an if block, and reset the variable in the oncomplete:

    Code:
    		case 'page' :	
    			if (this.currentlyFetching == false) {
                                this.currentlyFetching = true
                                var newAJAX = new Ajax.Request(
                                        this.contentToFetch, {
                                                method: 'get',
                                                parameters: '',
                                                onComplete: function(response) {
                                                        $('lightwindow_contents').innerHTML += response.responseText;
                                                        this.resizeTo.height = $('lightwindow_contents').scrollHeight+(this.options.contentOffset.height);
                                                        this.resizeTo.width = $('lightwindow_contents').scrollWidth+(this.options.contentOffset.width);
                                                        this._processWindow();
                                                        this._processPostloadAction();
                                                        this.currentlyFetching = false;
                                                }.bind(this)
                                        }
                                );
                            }
    			
    			break;
    Now, any subsequent ajax requests will drop until the first one is completed.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •