1

I have a parent page which is within a iframe. I would like to call highslide which follows the scroll on parent page.

I tried placing code: Highslide, Auto follow scroll

It works fine when the parent page is not within an iframe. But when parent page within iframe, then the Highslide fails to auto follow the scroll.

Pls help on this

Community
  • 1
  • 1
nvd
  • 11
  • 2

1 Answers1

2

Put the script for the Highslide fixed popup mod (http://www.highslide.com/studies/position-fixed.html) in the parent page, and use highslide-full.js instead of highslide-with-gallery.js / highslide-with-html.js

Demo page: http://roadrash.no/hs-support/inside-iframe-fixed-mod.html

// Highslide fixed popup mod. Requires the "Events" component.
    if (!hs.ie || hs.uaVersion > 6) hs.extend ( hs.Expander.prototype, {
      fix: function(on) {
        var sign = on ? -1 : 1,
          stl = this.wrapper.style;

        if (!on) hs.getPageSize(); // recalculate scroll positions


        hs.setStyles (this.wrapper, {
          position: on ? 'fixed' : 'absolute',
          zoom: 1, // IE7 hasLayout bug,
          left: (parseInt(stl.left) + sign * hs.page.scrollLeft) +'px',
          top: (parseInt(stl.top) + sign * hs.page.scrollTop) +'px'
        });

        if (this.outline) {
          stl = this.outline.table.style;
          hs.setStyles (this.outline.table, {
            position: on ? 'fixed' : 'absolute',
            zoom: 1, // IE7 hasLayout bug,
            left: (parseInt(stl.left) + sign * hs.page.scrollLeft) +'px',
            top: (parseInt(stl.top) + sign * hs.page.scrollTop) +'px'
          });

        }
        this.fixed = on; // flag for use on dragging
      },
      onAfterExpand: function() {
          this.fix(true); // fix the popup to viewport coordinates
      },

      onBeforeClose: function() {
        this.fix(false); // unfix to get the animation right
      },

        onDrop: function() {
          this.fix(true); // fix it again after dragging
      },

      onDrag: function(sender, args) {
        //if (this.fixed) { // only unfix it on the first drag event
          this.fix(true);
        //}
      }

    });
RoadRash
  • 881
  • 6
  • 9