Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Callbacks fire on page load when they shouldn't
4th February, 21:44
Post: #1
Callbacks fire on page load when they shouldn't
So here's my code:

JS Code
var $joinButton = $("#JoinThisGroup");        
        var buttonType = $joinButton.attr("class")
        if (buttonType == "JoinGroup") {
            joinUri = $joinButton.attr("rel");
            $joinButton.qtip({
                content: {
                    url: joinUri,
                    method: 'get',
                    prerender: false
                },
                show: 'click',
                hide: 'blur',
                position: {
                    corner: {
                        target: 'rightTop',
                        tooltip: 'leftTop'
                    }
                },
                style: 'formTip',
                onContentLoad: $joinButton.replaceWith("<span></span>")
            });
        }


Basically, what's happening is that the onContentLoad is firing before the qTip appears via the click method on the $joinButton dom node. This implies that the AJAX call has run already -- it hasn't, because the page it talks to performs some server side stuff that doesn't run until I click the $joinButton. So, in short, everything is working, except the callbacks (all of the callbacks I tested, anyways) are firing on page load.

What's going on here?
Find all posts by this user
Quote this message in a reply
4th February, 22:12
Post: #2
Callbacks fire on page load when they shouldn't
I fixed it with help from: http://craigsworks.com/projects/qtip/for...page-load/

FYI, this is definitely a weak-point in the API. You should probably do a check to see if the content is going to be dynamic, and if it is, refrain from firing the associated content-creation API events until the AJAX call actually executes. Other than that, great work, thank you -- if you do happen to release a version with a fix to the API, I will be more than happy to donate!
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Dynamic content from page variables kenswdev 0 418 9th February 18:06
Last Post: kenswdev
  Dynamic Content on first show, not page load TheOverbob 6 6,950 2nd August 13:01
Last Post: Craig
  [Solved] Displaying tooltip on page load/mouseover otherwise burghars 1 1,357 18th July 11:55
Last Post: Craig
  [Solved] modal with URL from another page? dod 2 1,502 2nd May 19:07
Last Post: Craig
  Load an HTML Page Within qTip Tooltip BruceBruce 3 3,336 19th January 12:17
Last Post: Craig
  [Solved] qTp modal dialog , on page load c0mrade 5 3,987 13th August 16:13
Last Post: mattsyk
  Tutorial: Dynamic content on first load using ajax Abrasive 0 4,825 28th June 05:44
Last Post: Abrasive
  how to load different content each time andufo 1 1,844 28th May 16:00
Last Post: andufo
  Dynamically Loading Specifc Content from Page ChuckLew 1 1,955 23rd November 00:13
Last Post: Craig



User(s) browsing this thread: 1 Guest(s)