How to put the displacement effect on the body so that when we go down with the scrollbar the bottom of the body; Do not go down so rough but find a nice little transition.
I have done some research and here are examples of what I need:
I do not know if this is the scrollbar you are looking for, it is with jquery and I hope it serves you.
(function($){
$(window).load(function(){
$.mCustomScrollbar.defaults.scrollButtons.enable=true; //enable scrolling buttons by default
$.mCustomScrollbar.defaults.axis="yx"; //enable 2 axis scrollbars by default
$("#content-rds").mCustomScrollbar({theme:"rounded-dots"});
$(".all-themes-switch a").click(function(e){
e.preventDefault();
var $this=$(this),
rel=$this.attr("rel"),
el=$(".content");
switch(rel){
case "toggle-content":
el.toggleClass("expanded-content");
break;
}
});
});
})(jQuery);
@import url(http://fonts.googleapis.com/css?family=Lobster+Two:700italic,700);
@import url(http://fonts.googleapis.com/css?family=Oswald:300);
body{
background-color: #222;
color: #eee;
font-size: 14px;
font-family: "Verdana",Geneva,sans-serif;
margin: 0;
padding: 0;
min-width: 480px;
}
h1, h2, h3{
font-family: "Lobster Two", "Georgia", serif;
font-weight: 700;
font-style: italic;
color: #6bdaea;
}
hr{
background-color: transparent;
height: 0;
border: none;
border-bottom: 1px solid rgba(255,255,255,0.08);
border-top: 1px solid rgba(0,0,0,0.9);
margin: 0;
clear: both;
}
h1{
margin: 20px 0;
color: inherit;
}
.content{
overflow: auto;
position: relative;
padding: 20px;
background: #333;
margin: 10px;
width: 740px;
max-width: 97%;
height: 400px;
-webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;
}
.content hr{
margin-bottom: -10px;
border-top: 1px solid rgba(0,0,0,0.7);
}
.content p{ margin: 30px 0; }
.content p:last-child{ margin-bottom: 5px; }
.content p:nth-child(odd), .content.light p:nth-child(odd){
background: #444;
background: rgba(255,255,255,0.1);
padding: 5px 10px;
-webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;
}
.content p:nth-child(3n+3){
color: #bbb;
background: none;
padding: 0;
}
.content h2{
font-size: 200%;
line-height: 130%;
}
.content h2:first-child{ margin-top: 5px; }
.content:nth-child(odd) h2{
font-family: "Oswald", sans-serif;
font-weight: 300;
font-style: normal;
}
@media only screen and (min-width: 1229px){
.showcase .horizontal-images.content{ width: 1060px; }
}
@media only screen and (min-width: 1629px){
.showcase .horizontal-images.content{ width: 700px; }
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Scrollbar con Jquery</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="https://dl.dropboxusercontent.com/s/h6j1ynikq69ecoz/scroll.css" rel="stylesheet"/>
</head>
<body>
<div id="content-rds" class="content">
<h2>Scroball con jquery</h2>
<hr />
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.</p>
<p>Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.</p>
<p>Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur?</p>
<p>Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas...</p>
<hr />
<p>Fin del contenido.</p>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://dl.dropboxusercontent.com/s/mbxdnhkqpdomxxv/jquery.scrollController.js"></script>
</body>
</html>
It is the same as the wordpress page that you put in the question, but I took the code from another side. I clarify: I do not know who the original author was, so I put it only as a guide. If you have any questions, you can comment.
If I understood well what you want to achieve ...
It can be done with some tricks of CSS
, for example you can put everything in a container in which will go all the content with the "smooth scrool", and play with the perspectiva
and the transformaciones
to be able to zoom out in the Z plane with translateZ()
and at the same time zoom in using scale()
the content and that there is the illusion of a not so rough scroll, something like this:
The CSS
html,
body {
margin: 0;
padding: 0;
}
.smooth-container {
height: 100vh;
overflow-x: hidden;
overflow-y: auto;
-webkit-perspective: 300px;
perspective: 300px;
}
.smooth-container__group {
position: relative;
height: 100vh;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.smooth-container__layer {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.smooth-container__layer--deep {
-webkit-transform: translateZ(-1500px) scale(6);
transform: translateZ(-1500px) scale(6);
z-index: 1;
}
HTML
<div class="smooth-container">
<div class="smooth-container__group">
<div class="smooth-container__layer smooth-container__layer--deep">
Tu contenido
</div>
</div>
</div>
The advantage of this is that everything can be achieved with CSS
, apart from being 100% responsive.
I tried it on macOS with Firefox, Chrome and Safari. I leave you the link to codepen in case you want to see it clearer.
I hope I have been helpful