2011-10-26 4 views
1

Imageflow 갤러리 플러그인 (http://imageflow.finnrudolph.de/)에서 마우스 휠 스크롤을 사용하지 않도록 설정하려고합니다. 마우스 휠과 관련된 섹션을 주석 처리했습니다. 자동 스크롤 옵션에 영향을 미치는 것 같습니다. 어떤 도움을 많이 주시면 감사하겠습니다. 여기에 '코드 : var my = this;ImageFlow 갤러리에서 마우스 휠 스크롤 끄기

/* Initiate ImageFlow */ 
this.init = function (options) 
{ 
    /* Evaluate options */ 
    for(var name in my.defaults) 
    { 
     this[name] = (options !== undefined && options[name] !== undefined) ? options[name] : my.defaults[name]; 
    } 

    /* Try to get ImageFlow div element */ 
    var ImageFlowDiv = document.getElementById(my.ImageFlowID); 
    if(ImageFlowDiv) 
    { 
     /* Set it global within the ImageFlow scope */ 
     ImageFlowDiv.style.visibility = 'visible'; 
     this.ImageFlowDiv = ImageFlowDiv; 

     /* Try to create XHTML structure */ 
     if(this.createStructure()) 
     { 
      this.imagesDiv = document.getElementById(my.ImageFlowID+'_images'); 
      this.captionDiv = document.getElementById(my.ImageFlowID+'_caption'); 
      this.navigationDiv = document.getElementById(my.ImageFlowID+'_navigation'); 
      this.scrollbarDiv = document.getElementById(my.ImageFlowID+'_scrollbar'); 
      this.sliderDiv = document.getElementById(my.ImageFlowID+'_slider'); 
      this.buttonNextDiv = document.getElementById(my.ImageFlowID+'_next'); 
      this.buttonPreviousDiv = document.getElementById(my.ImageFlowID+'_previous'); 
      this.buttonSlideshow = document.getElementById(my.ImageFlowID+'_slideshow'); 

      this.indexArray = []; 
      this.current = 0; 
      this.imageID = 0; 
      this.target = 0; 
      this.memTarget = 0; 
      this.firstRefresh = true; 
      this.firstCheck = true; 
      this.busy = false; 

      /* Set height of the ImageFlow container and center the loading bar */ 
      var width = this.ImageFlowDiv.offsetWidth; 
      var height = Math.round(width/my.aspectRatio); 
      document.getElementById(my.ImageFlowID+'_loading_txt').style.paddingTop = ((height * 0.5) -22) + 'px'; 
      ImageFlowDiv.style.height = height + 'px'; 

      /* Init loading progress */ 
      this.loadingProgress(); 
     } 
    } 
}; 


/* Create HTML Structure */ 
this.createStructure = function() 
{ 
    /* Create images div container */ 
    var imagesDiv = my.Helper.createDocumentElement('div','images'); 

    /* Shift all images into the images div */ 
    var node, version, src, imageNode; 
    var max = my.ImageFlowDiv.childNodes.length; 
    for(var index = 0; index < max; index++) 
    { 
     node = my.ImageFlowDiv.childNodes[index]; 
     if (node && node.nodeType == 1 && node.nodeName == 'IMG') 
     { 
      /* Add 'reflect.php?img=' */ 
      if(my.reflections === true) 
      { 
       version = (my.reflectionPNG) ? '3' : '2'; 
       src = my.imagePath+node.getAttribute('src',2); 
       src = my.reflectPath+'reflect'+version+'.php?img='+src+my.reflectionGET; 
       node.setAttribute('src',src); 
      } 

      /* Clone image nodes and append them to the images div */ 
      imageNode = node.cloneNode(true); 
      imagesDiv.appendChild(imageNode); 
     } 
    } 

    /* Clone some more images to make a circular animation possible */ 
    if(my.circular) 
    { 
     /* Create temporary elements to hold the cloned images */ 
     var first = my.Helper.createDocumentElement('div','images'); 
     var last = my.Helper.createDocumentElement('div','images'); 

     /* Make sure, that there are enough images to use circular mode */ 
     max = imagesDiv.childNodes.length; 
     if(max < my.imageFocusMax) 
     { 
      my.imageFocusMax = max; 
     } 

     /* Do not clone anything if there is only one image */ 
     if(max > 1) 
     { 
      /* Clone the first and last images */ 
      var i; 
      for(i = 0; i < max; i++) 
      { 
       /* Number of clones on each side equals the imageFocusMax */ 
       node = imagesDiv.childNodes[i]; 
       if(i < my.imageFocusMax) 
       { 
        imageNode = node.cloneNode(true); 
        first.appendChild(imageNode); 
       } 
       if(max-i < my.imageFocusMax+1) 
       { 
        imageNode = node.cloneNode(true); 
        last.appendChild(imageNode); 
       } 
      } 

      /* Sort the image nodes in the following order: last | originals | first */ 
      for(i = 0; i < max; i++) 
      { 
       node = imagesDiv.childNodes[i]; 
       imageNode = node.cloneNode(true); 
       last.appendChild(imageNode); 
      } 
      for(i = 0; i < my.imageFocusMax; i++) 
      { 
       node = first.childNodes[i]; 
       imageNode = node.cloneNode(true); 
       last.appendChild(imageNode); 
      } 

      /* Overwrite the imagesDiv with the new order */ 
      imagesDiv = last; 
     } 
    } 

    /* Create slideshow button div and append it to the images div */ 
    if(my.slideshow) 
    { 
     var slideshowButton = my.Helper.createDocumentElement('div','slideshow'); 
     imagesDiv.appendChild(slideshowButton); 
    } 

    /* Create loading text container */ 
    var loadingP = my.Helper.createDocumentElement('p','loading_txt'); 
    var loadingText = document.createTextNode(' '); 
    loadingP.appendChild(loadingText); 

    /* Create loading div container */ 
    var loadingDiv = my.Helper.createDocumentElement('div','loading'); 

    /* Create loading bar div container inside the loading div */ 
    var loadingBarDiv = my.Helper.createDocumentElement('div','loading_bar'); 
    loadingDiv.appendChild(loadingBarDiv); 

    /* Create captions div container */ 
    var captionDiv = my.Helper.createDocumentElement('div','caption'); 

    /* Create slider and button div container inside the scrollbar div */ 
    var scrollbarDiv = my.Helper.createDocumentElement('div','scrollbar'); 
    var sliderDiv = my.Helper.createDocumentElement('div','slider'); 
    scrollbarDiv.appendChild(sliderDiv); 
    if(my.buttons) 
    { 
     var buttonPreviousDiv = my.Helper.createDocumentElement('div','previous', 'button'); 
     var buttonNextDiv = my.Helper.createDocumentElement('div','next', 'button'); 
     scrollbarDiv.appendChild(buttonPreviousDiv); 
     scrollbarDiv.appendChild(buttonNextDiv); 
    } 

    /* Create navigation div container beneath images div */ 
    var navigationDiv = my.Helper.createDocumentElement('div','navigation'); 
    navigationDiv.appendChild(captionDiv); 
    navigationDiv.appendChild(scrollbarDiv); 

    /* Update document structure and return true on success */ 
    var success = false; 
    if (my.ImageFlowDiv.appendChild(imagesDiv) && 
     my.ImageFlowDiv.appendChild(loadingP) && 
     my.ImageFlowDiv.appendChild(loadingDiv) && 
     my.ImageFlowDiv.appendChild(navigationDiv)) 
    { 
     /* Remove image nodes outside the images div */ 
     max = my.ImageFlowDiv.childNodes.length; 
     for(index = 0; index < max; index++) 
     { 
      node = my.ImageFlowDiv.childNodes[index]; 
      if (node && node.nodeType == 1 && node.nodeName == 'IMG') 
      { 
       my.ImageFlowDiv.removeChild(node); 
      } 
     } 
     success = true; 
    } 
    return success; 
}; 


/* Manage loading progress and call the refresh function */ 
this.loadingProgress = function() 
{ 
    var p = my.loadingStatus(); 
    if((p < 100 || my.firstCheck) && my.preloadImages) 
    { 
     /* Insert a short delay if the browser loads rapidly from its cache */ 
     if(my.firstCheck && p == 100) 
     { 
      my.firstCheck = false; 
      window.setTimeout(my.loadingProgress, 100); 
     } 
     else 
     { 
      window.setTimeout(my.loadingProgress, 40); 
     } 
    } 
    else 
    { 
     /* Hide loading elements */ 
     document.getElementById(my.ImageFlowID+'_loading_txt').style.display = 'none'; 
     document.getElementById(my.ImageFlowID+'_loading').style.display = 'none'; 

     /* Refresh ImageFlow on window resize - delay adding this event for the IE */ 
     window.setTimeout(my.Helper.addResizeEvent, 1000); 

     /* Call refresh once on startup to display images */ 
     my.refresh(); 

     /* Only initialize navigation elements if there is more than one image */ 
     if(my.max > 1) 
     { 
      /* Initialize mouse, touch and key support */ 
      my.MouseWheel.init(); 
      my.MouseDrag.init(); 
      my.Touch.init(); 
      my.Key.init(); 

      /* Toggle slideshow */ 
      if(my.slideshow) 
      { 
       my.Slideshow.init(); 
      } 

      /* Toggle scrollbar visibility */ 
      if(my.slider) 
      { 
       my.scrollbarDiv.style.visibility = 'visible'; 
      } 
     } 
    } 
}; 

답변

1

나는 동일한 문제가있었습니다. 그러나 수정되지 않은 버전 1.3.0의 경우 다음을 포함하는 313 행을 편집합니다.

my.MouseWheel.init(); 

그냥 주석 처리하십시오.

이제 자동 스크롤도했는데 div 또는 이미지를 클릭하면 멈 춥니 다. 따라서 주석을 사용하여 819 행을 비활성화했습니다.

my.Slideshow.stop(); 
관련 문제