Solved

OnLoad image with Shadowbox

Posted on 2014-03-11
5
1,421 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
  • 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 55

Assisted Solution

by:Julian Hansen
Julian Hansen earned 200 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 300 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
100% tall div not scrollable on iPhone 3 20
Copying table data to one another 15 31
Need output in powershell ( Vertical format) 2 22
CSS Style 8 20
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

830 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