?
Solved

OnLoad image with Shadowbox

Posted on 2014-03-11
5
Medium Priority
?
1,499 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 58

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

770 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