Scrolling now works correctly when loading thumbnails
This commit is contained in:
parent
bf8939cf06
commit
e1e0b4f3cc
|
@ -615,7 +615,7 @@ button {
|
||||||
display: none;
|
display: none;
|
||||||
color: #222;
|
color: #222;
|
||||||
font: 12px Lato;
|
font: 12px Lato;
|
||||||
max-width: 480px;
|
max-width: 100%;
|
||||||
padding: 6px 8px;
|
padding: 6px 8px;
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,7 @@
|
||||||
/*!
|
/*!
|
||||||
* stickyscroll
|
* stickyscroll
|
||||||
* https://github.com/erming/stickyscroll
|
* https://github.com/erming/stickyscroll
|
||||||
* v2.1.1
|
* v2.2.0
|
||||||
*/
|
*/
|
||||||
(function($) {
|
(function($) {
|
||||||
$.fn.sticky = function() {
|
$.fn.sticky = function() {
|
||||||
|
@ -10,21 +10,21 @@
|
||||||
$(this).sticky(options);
|
$(this).sticky(options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var isBottom = false;
|
var isBottom = false;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.unbind(".sticky");
|
this.unbind(".sticky");
|
||||||
this.on("beforeAppend.sticky", function() {
|
this.on("beforeAppend.sticky", function() {
|
||||||
isBottom = isScrollBottom.call(self);
|
isBottom = isScrollBottom.call(self);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on("afterAppend.sticky", function() {
|
this.on("afterAppend.sticky", function() {
|
||||||
if (isBottom) {
|
if (isBottom) {
|
||||||
self.scrollBottom();
|
self.scrollBottom();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var overflow = this.css("overflow-y");
|
var overflow = this.css("overflow-y");
|
||||||
if (overflow == "visible") {
|
if (overflow == "visible") {
|
||||||
overflow = "auto";
|
overflow = "auto";
|
||||||
|
@ -32,12 +32,12 @@
|
||||||
this.css({
|
this.css({
|
||||||
"overflow-y": overflow
|
"overflow-y": overflow
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).unbind(".sticky");
|
$(window).unbind(".sticky");
|
||||||
$(window).on("resize.sticky", function() {
|
$(window).on("resize.sticky", function() {
|
||||||
self.scrollBottom();
|
self.scrollBottom();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.scrollBottom();
|
this.scrollBottom();
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
@ -48,6 +48,8 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$.fn.isScrollBottom = isScrollBottom;
|
||||||
|
|
||||||
function isScrollBottom() {
|
function isScrollBottom() {
|
||||||
if ((this.scrollTop() + this.outerHeight() + 1) >= this.prop("scrollHeight")) {
|
if ((this.scrollTop() + this.outerHeight() + 1) >= this.prop("scrollHeight")) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -595,7 +595,21 @@ $(function() {
|
||||||
|
|
||||||
chat.on("click", ".toggle-button", function() {
|
chat.on("click", ".toggle-button", function() {
|
||||||
var self = $(this);
|
var self = $(this);
|
||||||
self.parent().next(".toggle-content").toggleClass("show");
|
var chat = self.closest(".chat");
|
||||||
|
var bottom = chat.isScrollBottom();
|
||||||
|
var content = self.parent().next(".toggle-content");
|
||||||
|
if (bottom && !content.hasClass("show")) {
|
||||||
|
var img = content.find("img");
|
||||||
|
if (img.length != 0 && !img.width()) {
|
||||||
|
img.on("load", function() {
|
||||||
|
chat.scrollBottom();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
content.toggleClass("show");
|
||||||
|
if (bottom) {
|
||||||
|
chat.scrollBottom();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var windows = $("#windows");
|
var windows = $("#windows");
|
||||||
|
|
Loading…
Reference in New Issue