thedesk/app/js/ui/scroll.js

49 lines
1.4 KiB
JavaScript
Raw Normal View History

2018-01-28 23:22:43 +11:00
//スクロールで続きを読む
function scrollevent() {
2018-02-05 01:56:31 +11:00
$(".tl-box").scroll(function() {
2018-01-28 23:22:43 +11:00
scrollck();
});
}
scrollevent();
function scrollck() {
2018-02-05 01:56:31 +11:00
$(".tl-box").each(function(i, elem) {
2018-01-28 23:22:43 +11:00
var tlid = $(this).attr('tlid');
//一番上ならためていた新しいトゥートを表示
if ($(this).scrollTop() == 0) {
var pool = localStorage.getItem("pool_" + tlid);
if (pool) {
$("#timeline_" + tlid).prepend(pool);
jQuery("time.timeago").timeago();
localStorage.removeItem("pool_" + tlid);
}
2018-02-13 06:16:46 +11:00
//自動リフレッシュ
2018-09-10 03:06:00 +10:00
if( $("#timeline_" + tlid+" .cvo").length > 30 ){
for(var i=30;i<$("#timeline_" + tlid +" .cvo").length;i++){
2018-02-13 06:16:46 +11:00
$("#timeline_" + tlid +" .cvo").eq(i).remove();
}
}
2018-01-28 23:22:43 +11:00
}
//続きを読むトリガー
2018-03-15 06:42:48 +11:00
var scrt = $(this).find(".tl").height() - $(window).height();
2018-01-28 23:22:43 +11:00
var scr = $(this).scrollTop();
if (scr > scrt) {
moreload('', tlid);
}
});
}
2018-01-31 03:43:01 +11:00
function goTop(id){
2018-02-25 02:59:53 +11:00
if ($("#timeline_box_"+id+"_box .tl-box").scrollTop() > 500){
$("#timeline_box_"+id+"_box .tl-box").scrollTop(500)
}
$("#timeline_box_"+id+"_box .tl-box").animate({scrollTop:0});
2018-04-07 14:31:09 +10:00
}
function goColumn(key){
2018-07-29 17:37:54 +10:00
$("#sort-box").addClass("hide");
$("#sort-box").removeClass("show");
2018-04-07 14:31:09 +10:00
if($('[tlid='+key+']').length){
console.log($('[tlid='+key+']').offset().left);
$("#timeline-container").animate({scrollLeft:$("#timeline-container").scrollLeft()+$('[tlid='+key+']').offset().left});
}
2018-01-31 03:43:01 +11:00
}