Highslide(iframes的监听者)

时间:2016-05-17 21:02:07

标签: javascript jquery highslide

var args = {    objectType: "iframe", 
                align:      "center", 
                width:      "356", 
                height:     "500",
                src:        "http://my.api.endpoint?id=",
}
$("a[rel='highslide']").on("click",function(){
    var id = $(this).data("id");
    var setargs = args;
    setargs.src += id;
    hs.htmlExpand($(this), setargs );
});

无论出于何种原因,这只是旋转和旋转,并且不会加载我的端点或任何其他src。

1 个答案:

答案 0 :(得分:0)

无论如何,这是解决方案:

<script>
//listener for links
var args = {    objectType: "iframe", 
                align:      "center", 
                width:      "456", 
                height:     "500",
                src:        "http://my.api.endpoint?id=",
}
hs.onSetClickEvent = function ( sender, e ) {
   e.element.onclick = function () { 
      var id = $(this).data("id");
      var setargs = args;
      setargs.src += id;
      return(hs.htmlExpand(this, args)); 
   }
   return false;
}
</script>

<a rel="highslide-iframe">Link, here.</a>