0

i need to call a function when shadowbox is opened and displayed in my page. I try this:

Shadowbox.open({
    content:    contentD,
    player:     "html",
    title:      "Pubblicazione annunci in corso...",
    height:     350,
    width:      350,
    options: { 
            modal:   true,
            onOpen: myOpen
    }
});

function myOpen(){
   alert('ok');
}

My problem is that alert('ok') is shown before shadowbox is displayed, what can i do? can someone help me?

Charles
  • 50,943
  • 13
  • 104
  • 142
Jayyrus
  • 12,961
  • 41
  • 132
  • 214
  • unfortunately there're not other suitable hooks and the author didn't provided the original source in the package, so it's difficult to debug the code. - dannazione! :| – Fabrizio Calderan May 24 '12 at 11:09
  • Have you tried to set timeout for alert like `setTimeout(function() { alert('ok'); }, 1);`? – VisioN May 24 '12 at 11:09
  • @VisioN, it doesn't works.. alert message is shown before shadowbox is displayed.. – Jayyrus May 24 '12 at 12:00
  • @F.Calderan, the source for Shadowbox v3.0.3 is on [gitHub](https://github.com/mjijackson/shadowbox/tree/v3.0.3). – arttronics May 25 '12 at 11:52

1 Answers1

1

Change onOpen by onClose ;)

Shadowbox.open({
    content:    contentD,
    player:     "html",
    title:      "Pubblicazione annunci in corso...",
    height:     350,
    width:      350,
    options: { 
            modal:   true,
            onClose: myOpen
    }
});
SKJ
  • 2,184
  • 1
  • 13
  • 25