Created
October 3, 2016 13:21
-
-
Save Dartv/4012ede053219f75e324c3f68a829f7d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const $chat = $('.chat-content'); | |
const $message = $(ReactDOM.findDOMNode(component)); | |
const msgOffset = $message.offset().top; | |
// center the linked message in the chat box | |
const elHeight = $message.height(); | |
const chatHeight = $chat.height(); | |
const offset = msgOffset - ((chatHeight / 2) - (elHeight / 2)); | |
$chat.scrollTop(offset); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment