how to detect if the end of horizontal scrollbar is reached? [duplicate]










1
















This question already has an answer here:



  • How do I get the max value of scrollLeft?

    8 answers



I have a div wich is scrollable horizontally. I want to know when I reach the end of it.



Is there is simple way to detect if the horizontal scrollbar is scrollable to one direction or the other?










share|improve this question













marked as duplicate by raina77ow javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 15 '18 at 13:39


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    Math.abs(el.scrollLeft) === el.scrollWidth - el.clientWidth

    – raina77ow
    Nov 15 '18 at 13:16











  • thank you @raina77ow that works for me

    – Ic3m4n
    Nov 15 '18 at 13:27















1
















This question already has an answer here:



  • How do I get the max value of scrollLeft?

    8 answers



I have a div wich is scrollable horizontally. I want to know when I reach the end of it.



Is there is simple way to detect if the horizontal scrollbar is scrollable to one direction or the other?










share|improve this question













marked as duplicate by raina77ow javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 15 '18 at 13:39


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    Math.abs(el.scrollLeft) === el.scrollWidth - el.clientWidth

    – raina77ow
    Nov 15 '18 at 13:16











  • thank you @raina77ow that works for me

    – Ic3m4n
    Nov 15 '18 at 13:27













1












1








1









This question already has an answer here:



  • How do I get the max value of scrollLeft?

    8 answers



I have a div wich is scrollable horizontally. I want to know when I reach the end of it.



Is there is simple way to detect if the horizontal scrollbar is scrollable to one direction or the other?










share|improve this question















This question already has an answer here:



  • How do I get the max value of scrollLeft?

    8 answers



I have a div wich is scrollable horizontally. I want to know when I reach the end of it.



Is there is simple way to detect if the horizontal scrollbar is scrollable to one direction or the other?





This question already has an answer here:



  • How do I get the max value of scrollLeft?

    8 answers







javascript






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 13:12









Ic3m4nIc3m4n

8719




8719




marked as duplicate by raina77ow javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 15 '18 at 13:39


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by raina77ow javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 15 '18 at 13:39


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 1





    Math.abs(el.scrollLeft) === el.scrollWidth - el.clientWidth

    – raina77ow
    Nov 15 '18 at 13:16











  • thank you @raina77ow that works for me

    – Ic3m4n
    Nov 15 '18 at 13:27












  • 1





    Math.abs(el.scrollLeft) === el.scrollWidth - el.clientWidth

    – raina77ow
    Nov 15 '18 at 13:16











  • thank you @raina77ow that works for me

    – Ic3m4n
    Nov 15 '18 at 13:27







1




1





Math.abs(el.scrollLeft) === el.scrollWidth - el.clientWidth

– raina77ow
Nov 15 '18 at 13:16





Math.abs(el.scrollLeft) === el.scrollWidth - el.clientWidth

– raina77ow
Nov 15 '18 at 13:16













thank you @raina77ow that works for me

– Ic3m4n
Nov 15 '18 at 13:27





thank you @raina77ow that works for me

– Ic3m4n
Nov 15 '18 at 13:27












1 Answer
1






active

oldest

votes


















-1














To check the horizontal scrollbar you need to use



var scrollLeft = $('#div_id').scrollLeft();


You can then check if it's equal to the $('#div_id').width() and there's the end.






share|improve this answer





























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    -1














    To check the horizontal scrollbar you need to use



    var scrollLeft = $('#div_id').scrollLeft();


    You can then check if it's equal to the $('#div_id').width() and there's the end.






    share|improve this answer



























      -1














      To check the horizontal scrollbar you need to use



      var scrollLeft = $('#div_id').scrollLeft();


      You can then check if it's equal to the $('#div_id').width() and there's the end.






      share|improve this answer

























        -1












        -1








        -1







        To check the horizontal scrollbar you need to use



        var scrollLeft = $('#div_id').scrollLeft();


        You can then check if it's equal to the $('#div_id').width() and there's the end.






        share|improve this answer













        To check the horizontal scrollbar you need to use



        var scrollLeft = $('#div_id').scrollLeft();


        You can then check if it's equal to the $('#div_id').width() and there's the end.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 15 '18 at 13:17









        Robert ŞtefanRobert Ştefan

        12




        12















            這個網誌中的熱門文章

            How to read a connectionString WITH PROVIDER in .NET Core?

            Node.js Script on GitHub Pages or Amazon S3

            Museum of Modern and Contemporary Art of Trento and Rovereto