From 20c296ce5398a61d6f664f0c0b47c9abdc9b2586 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sun, 1 Dec 2019 16:30:16 +0100 Subject: Add scroll to pinned item before removal --- view/js/main.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'view') diff --git a/view/js/main.js b/view/js/main.js index 9fe513694..94f290fae 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1128,7 +1128,12 @@ function dopin(id) { .done(function() { var i = $('#wall-item-pinned-' + id); var me = $('#item-pinnable-' + id); - $('#pinned-wrapper-' + id).fadeOut(function() { this.remove(); }); + if($('#pinned-wrapper-' + id).length) { + $('html, body').animate({ scrollTop: $('#region_2').offset().top }, 'slow', function() { + $('#pinned-wrapper-' + id).fadeOut(function() { this.remove(); + }); + }); + }; $('.wall-item-pinned').remove(); if(i.length) me.html(me.html().replace(aStr['unpin_item'],aStr['pin_item'])); -- cgit v1.2.3