Javascript:单击play.png后如何重定向到另一个页面?

Javascript:单击play.png后如何重定向到另一个页面?,javascript,php,jquery,html,redirect,Javascript,Php,Jquery,Html,Redirect,我刚买了电影剧本,我想调整一些东西,但我不知道怎么做。所以,我希望你能帮助我 使用此代码,当有人单击“play.png”时,将播放预告片。但是,当他们单击play.png时,我想重定向到另一个页面。怎么做 这是html: <div id="trailer-mask" data-bind="click: showTrailer" data-src="{{ $title->trailer }}">

我刚买了电影剧本,我想调整一些东西,但我不知道怎么做。所以,我希望你能帮助我

使用此代码,当有人单击“play.png”时,将播放预告片。但是,当他们单击play.png时,我想重定向到另一个页面。怎么做

这是html:

                    <div id="trailer-mask" data-bind="click: showTrailer" data-src="{{ $title->trailer }}">
                        <img class="img-responsive img-thumbnail" src="{{ $title->background }}">
                        <div class="center"><img class="img-responsive" src="{{ asset('assets/images/play.png') }}"> </div>
                    </div>

背景}}“>
这是javascript:

showTrailer: function() {
    var e = s("#trailer-mask");
    "default" == vars.trailersPlayer ? e.html('<div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item" src="' + e.data("src") + '?autoplay=1&iv_load_policy=3&modestbranding=1&rel=0" wmode="opaque" allowfullscreen="true"></iframe></div>') : (-1 != e.data("src").indexOf("youtube") ? videojs("trailer", {
        techOrder: ["youtube"]
    }).src(e.data("src")).play() : videojs("trailer", {
        techOrder: ["html5", "flash"]
    }).src(e.data("src")).play(), e.css("display", "none"), s("#trailer").css("display", "block"), s("#social").css("top", 0).css("left", 0), s("#lists").css("top", 0).css("right", 0), videojs("trailer").on("userinactive", function() {
        s("#social").css("display", "none"), s("#lists").css("display", "none")
    }), videojs("trailer").on("useractive", function() {
        s("#social").css("display", "block"), s("#lists").css("display", "block")
    }))
},
showtraile:function(){
var e=s(“拖车面罩”);
“默认值”==vars.trailersPlayer?e.html(“”):(-1!=e.data(“src”).indexOf(“youtube”)?videojs(“拖车”){
techOrder:[“youtube”]
}).src(e.data(“src”)).play():videojs(“拖车”{
techOrder:[“html5”,“flash”]
}).src(e.data(“src”)).play()、e.css(“display”、“none”)、s(“trail”).css(“display”、“block”)、s(“social”).css(“top”,0)、css(“left”,0)、s(“lists”).css(“top”,0)、css(“right”,0)、videojs(“trail”).on(“userinactive”,function(){
s(“#社交”).css(“显示”、“无”),s(#列表”).css(“显示”、“无”)
}),videojs(“拖车”)。在(“useractive”,函数()上{
s(“#social”).css(“显示”、“块”),s(#列表”).css(“显示”、“块”)
}))
},

使用上述代码,如果

只需在单击该图像时触发重定向(该图像有一个名为
.img responsive的类)


试试这个

$(".img-responsive").click(function(){
   window.location.href = "http://your-website.com";
});

Javascript方式:

location.href="http://www.domain.com/";
在新选项卡中打开:

window.location("http://www.domain.com/");
jQuery方式:

$(location).attr('href','http://www.domain.com/');

您可以在js函数中执行此操作:

showTrailer: function() {
    window.location.href = "http://yourDESIREDurl.com";
},
如果您有一个动态生成的div,那么在jQuery中,您可以通过以下方式使用事件委派:

$(document).on('click', '.img-responsive', function(){
    window.location.href = "http://yourDESIREDurl.com";
});
$(document).on('click', '.img-responsive', function(){
    window.location.href = "http://yourDESIREDurl.com";
});