[Solved] Stop Ajax Timer on DIV scroll up not working with ASP.Net master and content page in jQuery

nauna
 
on Jun 20, 2021 10:52 PM
2107 Views

hello,

this solution Stop Ajax Timer on DIV scroll up using jQuery in ASP.Net

It's not working as expected, it's giving bug kindly check

I have master page and content page project

These are things should work perfectly

1. By default on timer event the panel should remain on bottom

2. When user try to scroll up panel so user can see upward message

3. But when user again keep the panel to bottom to see last message then

4. Again panel should remain on bottom

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
    function ScrollPanelBottom() {
        var text =  $('.container');
        text.scrollTop(text[0].scrollHeight);
    };
  
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    if (prm != null) {
        prm.add_endRequest(function (sender, e) {
            if (sender._postBackSettings.panelsToUpdate != null) {
                var text = $('.container');
                text.scrollTop(text[0].scrollHeight);
            }
        });
    };
  
    $(function () {
        $('.container').on('mousedown', function (e) {
            $('#hfX').val(event.pageX);
        });
  
        $('.container').on('mouseup', function (e) {
            if (parseInt($('#hfX').val()) >= e.pageX) {
                var timer = $find('<%=timer.ClientID %>');
                timer._stopTimer();
            }
        });
  
        $('.container').on('mousewheel', function (e) {
            var timer = $find('<%=timer.ClientID %>');
            if (e.originalEvent.wheelDelta >= 0) {
                timer._stopTimer();
            } else {
                timer._startTimer();
            }
        });
  
        $('.content').on('mousedown', function (e) {
            e.stopPropagation();
        });
    });
</script>

 

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Jun 25, 2021 04:14 AM
nauna says:
$('#hfX').val(event.pageX);

Change with below.

$('[id*=hfX]').val(event.pageX);

And

nauna says:
if (parseInt($('#hfX').val()) >= e.pageX) {

Change with below.

if (parseInt($('[id*=hfX]').val()) >= e.pageX) {