Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Shadowbox

Options
  • 13-12-2011 10:27pm
    #1
    Registered Users 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 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 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 Posts: 11,979 ✭✭✭✭Giblet


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


Advertisement