#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2007
    Posts
    247
    Rep Power
    81

    Question SuperBox! - close "window" via link or button within "window"


    Hi there,

    I've searched Google etc. for ages! and cannot see resource on how to close the SuperBox model window via a button and/or a link from within the model - for example - within an iframe model.

    SuperBox! link - http://www.pierrebertet.net/projects/jquery_superbox/

    I know there is the "link" at the top of the model which will close the model "window", but I would like the choice to close it via a button and/or link within the iframe model...

    Has anyone came across this and has a solution to this method?

    Many thanks in advance for any help!

    J
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    284
    Rep Power
    255
    Don't use an iFrame. Try the AJAX method because JavaScript inside an iFrame can not go throughout the page without referencing the parent.. By using AJAX, the JS will be loaded into the page, during run-time, and thus will be able to talk to the other JS on that page. An iFrame on a web page is like a whole separate site, AJAX can interlace content from a file onto the web page at run-time. Also, the file being 'included' into the window should contain strictly content within the <body> tags, if that's where it's going. (Unlike an iFrame where the source should be laid out like a full HTML page.)

    You can use the 'parent' property in JavaScript to talk from the iFrame to the 'parent' web page as well..

    So instead of 'document.[etc]' use 'window.parent.document.[etc]'

    Or just use AJAX
    Last edited by s-p-n; October 27th, 2009 at 12:33 PM.
    - The Wise Guy
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2007
    Posts
    247
    Rep Power
    81
    Originally Posted by s-p-n
    Don't use an iFrame. Try the AJAX method because JavaScript inside an iFrame can not go throughout the page without referencing the parent.. By using AJAX, the JS will be loaded into the page, during run-time, and thus will be able to talk to the other JS on that page. An iFrame on a web page is like a whole separate site, AJAX can interlace content from a file onto the web page at run-time. Also, the file being 'included' into the window should contain strictly content within the <body> tags, if that's where it's going. (Unlike an iFrame where the source should be laid out like a full HTML page.)

    You can use the 'parent' property in JavaScript to talk from the iFrame to the 'parent' web page as well..

    So instead of 'document.[etc]' use 'window.parent.document.[etc]'

    Or just use AJAX
    Hi - thanks for your reply. I will implement the AJAX mode and perhaps try the Content mode as well.

    Saying this still, how do I use a link within the content to close the model window, instead of clicking the "Close" button-link attached to the model window itself?

    Code:
    Some content here...blablabla
    <p>
    <a href="#closethiswindow???">Close Window</a>
    </p>
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2007
    Posts
    247
    Rep Power
    81
    bump...

IMN logo majestic logo threadwatch logo seochat tools logo