www.webdeveloper.com
Results 1 to 3 of 3

Thread: Issue with Lightbox

  1. #1
    Join Date
    Feb 2009
    Posts
    2

    Issue with Lightbox

    Hi guys, I'm posting here to try and solve a little issue with a lightbox I'm using.

    The original code is here:
    http://www.nofunc.com/Sexy_Box

    I've managed to implement it just fine, but my understanding of javascript is so basic its not even funny, HTML CSS and even a little PHP I'm ok with lol.

    I'm trying to create a button or a link at least, that will turn off the popup, could you look into the javascript at that website and let me know how I should switch it off.

    I've tried onclicks and everything trying to mimick how it works to shut it off, I just want the extra option than just clicking anywhere outside the box, thanks

  2. #2
    Join Date
    May 2007
    Posts
    129
    Using this JavaScript:

    Code:
    function $(v) { return(document.getElementById(v)); }
    function $S(v) { return($(v).style); }
    function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
    function isset(v) { return((typeof(v)=='undefined' || v.length==0)?false:true); }
    function XYwin(v) { var z=agent('msie')?Array(document.body.clientHeight,document.body.clientWidth):Array(window.innerHeight,window.innerWidth); return(isset(v)?z[v]:z); }
    
    function closeSexyBox() { $S('sexyBG').display='none'; $S('sexyBOX').display='none'; document.onclick=function(){}; }
    
    function sexyTOG() { document.onclick=closeSexyBox; }
    function sexyBOX(v,b) { setTimeout("sexyTOG()",100); $S('sexyBG').height=XYwin(0)+'px'; $S('sexyBG').display='block'; $('sexyBOX').innerHTML=v+'<div class="sexyX">(click outside box to close)'+"<\/div>"; $S('sexyBOX').left=Math.round((XYwin(1)-b)/2)+'px'; $S('sexyBOX').width=b+'px'; $S('sexyBOX').display='block'; }
    You can then add the element (button etc) and set the onclick to call the closeSexyBox() function

  3. #3
    Join Date
    Feb 2009
    Posts
    2
    The issue is that whilst within the lightbox iframe, it is a child window, and so there would be nothing to close as it would not have opened anything, I have tried using target="_parent" and others but it doesn't work :/

    So I'm unsure what to do, I mean on the most basic level anyone wanting to login will click it, type their un/pw and submit, getting them out of it anyways, its just I was planning to use it at a later stage for short amounts of content, messages etc, so I would love an ability to turn it off from the child window

    Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles