Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

OnLoad image with Shadowbox

Posted on 2014-03-11
5
Medium Priority
?
1,520 Views
Last Modified: 2014-03-12
I followed instructions from shadowbox-js and I can't seem to load the image. It's stuck at loading. Code as below. Help?


<link rel="stylesheet" type="text/css" href="shadowbox.css">
<script type="text/javascript" src="shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init({
    skipSetup: true,
    players: ["img"]
});

window.onload = function() {

    // open a welcome message as soon as the window loads
    Shadowbox.open({
        content:    '<img src="images/GangNamStyle.jpg" alt="GangNam" />',
        player:     "img",
        title:      "Gangnam Style",
        height:     320,
        width:      320
    });

};
</script>

Open in new window

0
Comment
Question by:rolandmy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39920484
replace : '<img src="images/GangNamStyle.jpg" alt="GangNam" />',
by : "images/GangNamStyle.jpg",

Test page : http://jsfiddle.net/Rzk88/
0
 
LVL 59

Assisted Solution

by:Julian Hansen
Julian Hansen earned 800 total points
ID: 39920503
Try changing your player to html
<script type="text/javascript">
Shadowbox.init({
    skipSetup: true
});

window.onload = function() {

    // open a welcome message as soon as the window loads
    Shadowbox.open({
        content:    '<img src="images/a5.jpg" alt="GangNam" />',
        player:     "html",
        title:      "Gangnam Style",
        height:     320,
        width:      320
    });

};
</script>

Open in new window

Or change your content to just be the path of the image
<script type="text/javascript">
Shadowbox.init({
    skipSetup: true
});

window.onload = function() {

    // open a welcome message as soon as the window loads
    Shadowbox.open({
        content:    'images/a5.jpg',
        player:     "img",
        title:      "Gangnam Style",
        height:     320,
        width:      320
    });

};
</script>

Open in new window

0
 
LVL 2

Author Comment

by:rolandmy
ID: 39922442
I have followed the instruction and it's just not loading up. I have attached the html file along with the shadowbox css and js.

What am I doing wrong? =/
test.html
shadowbox.js
shadowbox.css
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 1200 total points
ID: 39922455
you shadowbox.js come from Mars.
Download it from here : http://www.shadowbox-js.com/download.html

Or use :

<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/shadowbox/3.0.3/shadowbox.css">
<script type="text/javascript" src="//cdn.jsdelivr.net/shadowbox/3.0.3/shadowbox.js"></script>

Open in new window

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question