jquery iframe变量和字符串



嗨,我的jquery和lightbox有问题,我正在尝试修补。

    isVideo : function (src){
            if( src ){
                if( 
                    src.match(/smartzer.com/([a-zA-Z0-9-_]+)/) 
                ){
                    return true;
                }
            }
        },
        getVideo : function(url){
            var iframe = '';
            var output = '';
            var SmartUrl = url.match(/([a-zA-Z0-9-_]+)/);

                iframe = '<iframe width="560" height="315" src="video.smartzer.com/'+SmartUrl[1]+'" scrolling="no" width="850" height="500"></iframe>';

            return '<div class="swipebox-video-container" style="max-width:'+plugin.settings.videomaxWidth+'px"><div class="swipebox-video">'+iframe+'</div></div>';
        },

HTML

<a class="swipebox-video" rel="youtube" href="http://video.smartzer.com/ih/">Video Is Here</a>

我正试图得到这个输出

<iframe width="850" height="500" src="http://video.smartzer.com/ih/" scrolling="no"></iframe>

但我得到了这个输出

<iframe width="850" height="500" src="http://video.smartzer.com/http" scrolling="no"></iframe>

我不能100%确定SmartUrl变量从哪里获取值。

如果它不是动态的,只关闭一次。然后做这个

var SmartUrl = 'ih';

iframe = '<iframe width="560" height="315" src="video.smartzer.com/' + SmartUrl + '" scrolling="no" width="850" height="500"></iframe>';

最新更新