使用JQuery在新窗口中打开图像链接

使用JQuery在新窗口中打开图像链接

问题描述:

    <script type="text/javascript">
(function($){
    $(window).load(function(){
        if(jQuery.isFunction(jQuery.fn.prettyPhoto)) {
            $.prettyPhoto.open(
                "images/ad1.jpg", // Image to be opened
                "title",    // Title of the pop-up
                "desc."     // The description
            );
            setTimeout(function() {
                $.prettyPhoto.close();
            }, 8000); // autoclose after 8 seconds
        } else {
            console.log("PrettyPhoto is not defined."); // log this message
        }
    });
})(jQuery);
</script>

我试图在新选项卡中打开图像(ad1.jpg)链接网址窗口。我将如何做到这一点?我尝试了很多方法来完成这项工作。感谢。

I am trying to make an image (ad1.jpg) link url to be opened in a new tab window. How would I do this? I have tried many options to make this work. Thanks.

这应该可以解决!

This should work!

<a target="_blank" href="http://your_url_here.html">Link</a>

希望这有助于获得更多详细信息,请参阅此处的答案在新标签或窗口中打开链接

Hope this helps for more detail see the answer here Open link in new tab or window