Highslide (listener for iframes)

74 Views Asked by At
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 );
});

for whatever reason, this just spins and spins and doesn't load my endpoint, or any other src, for that matter.

1

There are 1 best solutions below

1
Ben Coffin On

Anyway, here's the solution:

<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>