1

I'd like to open a div with html content in with shadow box. Does anyone know if this is possible with the plugin as I can't see it anywhere on their site? http://www.shadowbox-js.com/

Thanks for your help

Judi

brightmist.co.uk
  • 531
  • 5
  • 18
  • 47
  • http://stackoverflow.com/questions/10846419/how-can-i-open-inline-div-on-page-load-using-shadowbox, but I don't want the div to open on page load. I'd like it to open when I click an image. – brightmist.co.uk Apr 15 '13 at 09:02
  • also found these but can't get them to do what I want still https://github.com/mjijackson/shadowbox/tree/master/examples – brightmist.co.uk Apr 15 '13 at 09:03
  • Do you want to open an `image` in the lightbox or `text`? – Spokey Apr 15 '13 at 09:32
  • I'd like a div with content in it. I'm using a video playlist plugin called - responsive-video-gallery-html5-youtube-vimeo, which I would like to put inside the div. I've used an iframe with shadowbox at the moment but this is bulky as it means multiple html files for playlists instead of just one with all the playlists contained. – brightmist.co.uk Apr 15 '13 at 09:45
  • So just think of it as a hidden div with html content in – brightmist.co.uk Apr 15 '13 at 09:46

1 Answers1

2

I think this will get what you need.

An example where the lightbox will copy the elements in #cont when you click on a

        <div id="cont" style="display:none">
            <h1>Header</h1>
            <b>Test test</b>
            <i>Test test</i>
        </div>

        <a href="#">Open</a>

And the script

        Shadowbox.init({
            skipSetup: true
        });

        $('a').click(function() {
            var content = $('#cont').html();
            Shadowbox.open({
                content: content,
                player: 'html',
                displayNav:false,
                height: 350,
                width: 350
            });
        });

The box may display a black background so you have to change that into another color.

Please note that shadowbox.js is a player lightbox designed for playing videos. You may consider using something else for html content. The lightbox must contain a player otherwise it won't start.

Spokey
  • 10,974
  • 2
  • 28
  • 44