Fancybox iframe says that my YouTube href is undefined

Posted by user369732 on Stack Overflow See other posts from Stack Overflow or by user369732
Published on 2010-06-18T14:31:17Z Indexed on 2010/06/18 14:33 UTC
Read the original article Hit count: 313

Filed under:
|
|
|

Here is my HTML:

<a class="video iframe" href="http://www.youtube.com/watch?v=Psk2Pq03rv0">Arbitrary text</a>

Here is the Fancybox javascript:

$("a.video").fancybox({
'padding' : 0,
'autoScale' : false,
'title' : this.title,
'overlayOpacity' : '.6',
'overlayColor' : '#333',
'transitionIn' : 'none',
'transitionOut' : 'none',
'centerOnScroll' : false,
'showCloseButton' : true,
'hideOnOverlayClick': false,
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), "v/"),
'type' : 'swf',
'swf' : {
'wmode': 'transparent',
'allowfullscreen': 'true'
}
});

Firebug Console says:

this.href is undefined
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),

As a result, clicking this link takes the user to YouTube and does not trigger Fancybox. Any advice?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about iframe