qadenza
qadenza

Reputation: 9293

just one div scrollable on page

I need nothing on page to be scrollable except one div (divleft), and it should be scrollable by mouse, not by scrollbar. All scrollbars should be hidden.

I treid a solution with narrower parent div (divleftwrap), but id doesnt work.

<div id="slidetop">
323<br>
323<br>
323<br>
</div>
<div id="menutop"></div>
<div id="wrapt">
<div id="divleftwrap">
<div id="divleft">
...
</div>
</div>
<div id="divright">
...
</div>
<div class="clear"></div>
</div>

css

html, body{
  overflow:hidden;
}
#slidetop{
    display:none;
}
#menutop{
    height:25px;
    background:red;
}
#divleftwrap{
    float:left;
    width:60%;
    background:blue;
    height:100%;
}
#divleft{
    width:clac(100% + 17px);
    background:green;
  overflow-y:scroll;
}
#divright{
    width:25%;
  float:right;
    background:lightblue;
}

js - this should stay to work

$("#menutop").click(function(){
    $("#slidetop").slideToggle();
});

HERE IS JSFIDDLE

Upvotes: 0

Views: 52

Answers (1)

gaetanoM
gaetanoM

Reputation: 42044

I changed a bit your style sheet due a little error. In order to verify the scroll I reduced the height.

In the following the snippet:

$("#menutop").click(function(){
  $("#slidetop").slideToggle();
});
html, body{
  overflow:hidden;
}
#slidetop{
  display:none;
}
#menutop{
  height:25px;
  background:red;
}
#divleftwrap{
  float:left;
  width:60%;
  background:blue;
  height:200px;
  overflow: hidden;
}
#divleft{
  width:calc(100% + 17px);
  height: 110%;
  background:green;
  overflow-y:scroll;
}
#divright{
  width:25%;
  float:right;
  background:lightblue;
}
<script src="//code.jquery.com/jquery-1.11.3.js"></script>

<div id="slidetop">
    323<br>
    323<br>
    323<br>
</div>
<p id="test"></p>

<div id="menutop"></div>
<div id="wrapt">
    <div id="divleftwrap">
        <div id="divleft">
            STARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTARTSTART
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
            industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
            scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into
            electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of
            Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like
            Aldus PageMaker including versions of Lorem Ipsum.
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
            industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
            scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into
            electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of
            Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like
            Aldus PageMaker including versions of Lorem Ipsum.
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
            industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
            scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into
            electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of
            Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like
            Aldus PageMaker including versions of Lorem Ipsum.
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
            industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
            scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into
            electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of
            Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like
            Aldus PageMaker including versions of Lorem Ipsum.
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
            industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
            scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into
            electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of
            Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like
            Aldus PageMaker including versions of Lorem Ipsum.
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
            industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
            scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into
            electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of
            Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like
            Aldus PageMaker including versions of Lorem Ipsum.
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
            industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
            scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into
            electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of
            Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like
            Aldus PageMaker including versions of Lorem Ipsum.
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
            industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
            scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into
            electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of
            Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like
            Aldus PageMaker including versions of Lorem Ipsum.
            ENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDEND
        </div>
    </div>
    <div id="divright">
        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
        standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make
        a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting,
        remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing
        Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions
        of Lorem Ipsum.
    </div>
    <div class="clear"></div>
</div>

Upvotes: 1

Related Questions