Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Shadowbox

  • 13-12-2011 10:27PM
    #1
    Registered Users, Registered Users 2 Posts: 46


    Hi there,

    when i change this element
    <div class="content_column1"id="img8">
    <img src = images/img10.jpg id=img10.jpg alt= title = />;
    									</div>
    

    with this function in javascript
    var video1 = document.getElementById('img8');
    
    video1.innerHTML = "<a href=http://www.youtube.com/watch?
    v=Omf6GU_gKtM rel=shadowbox ;width=640;height=480;player=swf><img src = images/ferg.jpg id=ferg.jpg alt= title = />"
    
    
    I want to change the image(which works), and then click to play a video in shadowbox.but when i pass the html from the function to the div tag it links straight to youtube, shadowbox doesnt appear, it works fine when I dont use the function??

    any ideas??


Comments

  • Registered Users, Registered Users 2 Posts: 339 ✭✭duffman85


    Make sure you have the Shadowbox.init() method call (I missed it the first few times)
    The youtube URL needs to be in the format shown below(this is taken from the youtube example in source of http://www.shadowbox-js.com/index.html).
    <!DOCTYPE html >
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>youtube</title>
        <link rel="stylesheet" type="text/css" href="shadowbox-3.0.3\shadowbox.css" />
        <script type="text/javascript" src="shadowbox-3.0.3\shadowbox.js"></script>
        <script type="text/javascript">
        [B]Shadowbox.init();[/B]
        </script>
      </head>
      <body>
      <div>
      <a rel="shadowbox;width=420;height=315;player=swf" title"Youtube Vid" 
    href="http://www.youtube.com/v/[B]Omf6GU_gKtM[/B]&amp;rel=0;&amp;hl=en;&amp;fs=1;&amp;autoplay=1"><img src="img.jpg" alt="img" /></a>
     
     
     </div>
     </body>
    
    </html>
    


  • Registered Users, Registered Users 2 Posts: 46 rambo85


    ya it works fine when I dont use the function,but if I use a function to change the html in the div tag with the new <a href> link it doesnt work???


  • Registered Users, Registered Users 2 Posts: 12,025 ✭✭✭✭Giblet


    init should probably be run after the function to load the anchor


Advertisement