Thiru Arasu
Thiru Arasu

Reputation: 293

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?

Upvotes: 0

Views: 1856

Answers (1)

prasanth
prasanth

Reputation: 22500

$("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>

Upvotes: 1

Related Questions