2013-07-04 2 views
1

스크롤 따라 발견이 주제 : http://highslide.com/forum/viewtopic.php?t=3030Highslide, 자동 내가 그에 대한 수정/솔루션을 찾고있었습니다

function fixElement(el) { 
    var stl = el.style; 
    stl.position = 'fixed'; 
    stl.top = (parseInt(stl.top) - hs.page.scrollTop) +'px'; 
    stl.left = (parseInt(stl.left) - hs.page.scrollLeft) +'px'; 
} 
function unfixElement(el) { 
    var stl = el.style; 
    stl.position = 'absolute'; 
    stl.top = (parseInt(stl.top) + hs.page.scrollTop) +'px'; 
    stl.left = (parseInt(stl.left) + hs.page.scrollLeft) +'px'; 
} 

if (!hs.ie || hs.ieVersion() > 6) { 
    hs.Expander.prototype.onAfterExpand = function() { 
     fixElement (this.wrapper); 
     if (this.outline) fixElement(this.outline.table); 
    }; 

    hs.Expander.prototype.onBeforeClose = function() { 
     unfixElement (this.wrapper); 
     if (this.outline) unfixElement(this.outline.table); 
    }; 
} 

가 포럼 주제에 작은 해킹을 얻었으나, 해킹은 인터넷에서 작동하지 않습니다 Explorer (IE7, IE8 및 IE9)를 시도했습니다.

누군가 IE에서 작동하도록 해킹에 "수정"이 있습니까?

내가 그것을 코드의이 부분,이 조건에 관련된 뭔가 생각 : (! hs.ie || hs.ieVersion()> 6)

경우

, 내가 제거하고 일을하지만, 어쩌면이 코드는 바뀔 수 있습니다.

감사합니다.

+0

당신은 8.0.6001이 –

+0

미안 해요, 난 당신이 오해를 많이 썼다 IE에서 완벽하게 잘 작동을 제공하는 해당 사이트가 필요합니다. 링크를 제거했습니다. 문제는,이 해킹은 Highslide가 붙어 있고 스크롤을 따라 움직이지 않아야한다는 것입니다. 해킹은 IE 버전에서 작동하지 않습니다. (원래 질문에 약간의 변경을했습니다.) 감사합니다. – saulob

+0

다음 사이트에서 예제를 제공 할 수 있습니까? –

답변

2

아래 코드는 필요한 것입니다. 라이브 데모 : http://www.highslide.com/studies/position-fixed.html
는 : highslide-full.js

// 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); 
     //} 
     } 

    }); 
+0

감사합니다. 모든 브라우저에서 정상적으로 작동합니다. 크롬, 파이어 폭스, 사파리와 IE7, IE8과 IE9. :) 감사합니다 – saulob

+0

@RoadRash,이 코드에 버그가 있습니다. 페이지 스크롤이 맨 위로 끝나지 않은 상태에서 드래그하면 드래그 한 요소가 드래그하는 동안 이동합니다. 또한 제공된 데모 링크에서 재생성 할 수 있습니다. –