Search code examples
scrollscrollbarraphael

how to add a scrollbar to raphael object ,for example,a rect object


In my Raphael paper, a rect object is larger than my paper width, How to add a scrollbar to this rect object . For example:

var paper = new Raphael("holder", 500, 400);

var rect = paper.rect(100, 100, 1000, 1000);

What i want to do is ,Inside the paper, add a ScrollBar component to this rect but not this paper.


Solution

  • You might try this,

    <div id="holder">
      <div id="rectangle-holder">
      </div>
    </div>
    
    var paper = new Raphael("holder", 500,400);
    var rectangleHolder  = new Raphael("rectangle-holder", 200,200);
    var rectangle = rectangleHolder.rectangle(100,100,1000,1000);
    

    Using CSS add scrolllbar to rectangle-holder div