Solved

OnLoad image with Shadowbox

Posted on 2014-03-11
5
1,388 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 52

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error in JQuery 5 39
Polygon I google maps 1 16
jquery to restrict certain words from input in form 11 17
Bootstrap on PLNKR 3 14
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now