Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Custom Content Scroller doesn't scroll to bottom
    primarykey
    data
    text
    <p>I use mCustomScrollbar for an element on a page, which gets reloaded at times. It's a messages view, and when the user clicks on another conversation, the messages of this conversation get loaded. However, when I want to scroll to bottom after loading this, as the newest messages are at bottom, it scrolls not to bottom but a few pixels above bottom ("a few" can be randomly between 10 and 200px).</p> <p>Below is a simplified example:</p> <pre><code>// code to load another conversation $(".conversations .conversation").click(function (e) { var $this = $(this); $.ajax({ url: W.sprintf('/messages/%s/fetch', $this.attr("data-cid")), dataType: 'html' }).done(function(data) { $('.main_pane.messages').html(data); // a function call to set the hight of .main_list.messages goes here $(".main_list.messages").mCustomScrollbar(W.scroll_prefs); $(".main_list.messages").mCustomScrollbar("scrollTo", "bottom"); // also tried adding an element at bottom and scrolling to this // and scrollTo Number.MAX_VALUE // also tried putting the two mCustomScrollbar lines both into // setTimeout() }); }); </code></pre> <pre class="lang-haml prettyprint-override"><code>&lt;!-- this is what gets loaded --&gt; #conversation .head -# some foo .conv_body .main_list.messages.custom-scroll.hide-scrollbar.start-bottom -# basically a bunch of these below .listelem.msg .left = image_tag(user.avatar.image(:icon), size: avatar_size(:icon)) .right %span.datetime= fmt_time(msg[:datetime], :time) .middle .name= link_to(user.login, user) .text= msg[:text] #new_message_container.main_input.open.threeline = form_for(@message) do |f| -# ... </code></pre> <p>CSS: just a few margins and paddings and colors and stuff, nothing fancy</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload