Need Shadowbox to fire off without a link and not using onLoad

2 messages Options
Embed this post
Permalink
MikeGoff

Need Shadowbox to fire off without a link and not using onLoad

Reply Threaded More More options
Print post
Permalink
I am currently working on a ColdFusion site where I need to have the SB fire off after a certain conditional is met.  We are trying to replace the use of a standard popup with SB, but can't seem to get it to fire.  

I keep getting an error in Line 1216 of the "Source" version of the shadowbox.js:

Error: obj is undefined
Source File: /shadowbox.js
Line: 1216  

for(var i = 0, len = obj.length; i < len; ++i)


Before I can implement this onto the site, I have been testing the idea through the use of a simple HTML page.  The code is below...

<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="shadowbox.css">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="shadowbox.js"></script>
<script type="text/javascript">
function demoMessage(){
        Shadowbox.init({
       
    // let's skip the automatic setup because we don't have any
    // properly configured link elements on the page
    skipSetup: true,
    // include the html player because we want to display some html content
    players: ["html"]
});

Shadowbox.open({
player: 'html',
content: '<div><h1>Hello World</h1></div>',
 height: 100,
width: 200
});
}

</script>

</head>
<body>

<script type="text/javascript" language="javascript">
demoMessage();
</script>

</body>
</html>



Any help in this matter will definitely result in us purchasing a commercial license for the script!!!

Thanks!
Wizzud

Re: Need Shadowbox to fire off without a link and not using onLoad

Reply Threaded More More options
Print post
Permalink
<!DOCTYPE HTML PUBLIC  "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd" >
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="shadowbox.css">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="shadowbox.js"></script>
<script type="text/javascript">
function demoMessage(){
  Shadowbox.open({
    player: 'html',
    content: '<div><h1 style="color:#fff;text-align:center;">Hello World<\/h1><\/div>',
    height: 100,
    width: 200
  });
};
$(function(){ //jQuery's DOM Ready
  // you still have to give the browser a chance to complete the insertion of
  // Shadowbox's html (from the init() call) ...
  window.setTimeout(demoMessage, 10);
});
</script>
</head>
<body>
<script type="text/javascript">
Shadowbox.init({skipSetup:true, players:['html']});
</script>
</body>
</html>
Combine literacy with curiosity and a whole world of information opens up to you