thiru arasu thiru arasu - 1 month ago 20
jQuery Question

How do i scrollRight in Jquery without Animate event?

How do i scrollRight in JQuery without animate event.
For scrollLeft ,we give like this

$("body","html").scrollLeft();


for scrollRight is possible without animate event?

scrollRight is possible with scrollLeft event?

Answer

$("body","html").scrollLeft('100'); Apply with in a value its will be scroll right.Example as shown below

For more Information

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
       $("div").scrollLeft('200');
    });
});
</script>
</head>
<body>

<div style="border:1px solid black;width:100px;height:130px;overflow:auto">
The longest word in the english dictionary is: pneumonoultramicroscopicsilicovolcanoconiosis.
</div><br>

<button>scroll right</button>

</body>
</html>

Comments