Loading ...
Sorry, an error occurred while loading the content.

5331Re: Slider left and right constraints being reset

Expand Messages
  • Bart Gottschalk
    Sep 30, 2006
    • 0 Attachment
      I've modified my code to now use the setValue method on the slider.
      With that change I'm not able to reproduce the error I described below.

      Here is the new code (from several different files):

      //create new slider
      this.createSlider("false","true",11,"horizBGDiv_ajax","horizHandleDiv_ajax",0,60);

      StoreLocator.prototype.createSlider =
      function(zoomMapVal,moveSliderVal,iniZoomLevelVal,bgDiv,sliderDiv,left,right)
      {
      ...

      //set the initial zoom level for later
      iniZoomLevel = iniZoomLevelVal;

      //Create zoom slider. Intentionally not a 'var' type variable to
      protect from multiple browser windows at the same time.
      horizontalSlider =
      YAHOO.widget.Slider.getHorizSlider(bgDiv,sliderDiv,left,right);

      //set onSlideEnd property on slider
      horizontalSlider.onSlideEnd = sliderZoomTo;

      //set onendzoom event for map so that we can reposition the slider if
      the zoom was initiated another way.
      this.map.AttachEvent("onendzoom", setZoomSlider);

      //set the slider after it's initialzed the the starting zoom level
      this.setZoomSliderOffset(iniZoomLevel);
      }

      function setZoomSlider(e) {
      storeLocatorApp.setZoomSliderOffset(e.view.zoomLevel);
      }

      StoreLocator.prototype.setZoomSliderOffset = function(zoomLevel){

      // create variable for new Offset
      var newOffset = 0;

      //code to determine appropriate value for newOffset...

      //set the newOffset value on slider horizontalSlider
      horizontalSlider.setValue(newOffset);
      };

      I've tested this a fair amount and haven't seen the left and right
      constraints reset. However, as I wasn't able to do this through a
      known process earlier I might just still be getting lucky. I'll post
      again if the problem resurfaces.

      Bart


      --- In ydn-javascript@yahoogroups.com, "Bart Gottschalk"
      <bartgottschalk@...> wrote:
      >
      > The YAHOO.widget.Slider I'm implementing is a custom control for a
      > Virtual Earth zoom bar. I also have custom zoom-in and zoom-out
      > buttons on the page as well as the double-click to zoom and center
      > functionality enabled.
      >
      > When the double-click or zoom-in/zoom-out functions are called I also
      > respoition the sliders thumb to correspond to the new zoom level.
      > Through some combination of events (I haven't been able to document
      > the specific combination yet) the left and right constraints of the
      > slider are being altered. Here is the code I'm using to change the
      > location of the slider:
      >
      > //get the slider div
      > var slider = DOMUtils.getElement("horizHandleDiv_ajax");
      > //set the new x offset for the slider
      > slider.style.left = newOffset + "px";
      >
      > Notice that I'm not doing this through the Yahoo.widget.Slider API.
      > I'm going directly to the DOM element and changing it's style.left
      > value. Is this a no-no? I've started to look at the setValue method
      > available on the slider API as another option
      >
      (http://developer.yahoo.com/yui/docs/slider/YAHOO.widget.Slider.html#setValue).
      >
      > Has anyone else implemented a slider and seen this type of behavior?
      > Any suggestions of things I should try to isolate the problem?
      >
      > Thanks!
      > Bart
      >
    • Show all 2 messages in this topic