SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problems with links using Shadowbox

    We are using the sahadowbox script for our popup boxes on a site and it is working fine except for 1 case.

    We have a link to pageB.php on pageA.php that has a rel="shadowbox" attribute in the a tag. If pageA is loaded and you click on the link to pageB.php it brings up pageB in the shadowbox and everything works fine.

    If pageA.php is still loading and you click on the link to pageB then pageB loads in a full page not the shadowbox.

    Has anyone seen this behavior?

    Is there a way to prevent it without locking out the page until it is completely loaded?

    Thanks for the help.

    Rodney

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    There are a couple of different ways.

    One way is to from the head of the document, capture any onclick events and cancel them. Then once the page is loaded you can disable that capture process.

    The JavaScript Forum will be able to help you nicely regarding this issue.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can we capture the onclick events that happen while the page is loading and then once the page is loaded process them instead of canceling them?

    thanks,
    Rodney

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Lake Wylie View Post
    Can we capture the onclick events that happen while the page is loading and then once the page is loaded process them instead of canceling them?
    Yes, but this has nothing to do with PHP. Please take this to the JavaScript Forum
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Guru
    Join Date
    Jun 2006
    Posts
    638
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lake Wylie: that is the downside of doing it using JS.

    You probably have a document.ready run a jQuery to update the links of A tags with the "sandbox" class.

    If the page is not fully loaded, then the code did not run, and your URL has not changed.

    If you want to make 100% sure your URLs change, you need to do it server side, using PHP.

    But I would put the sandbox on some other subdomain, than the live site, and don't worry about any links (make them all absolute, starting with /).


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
  •