Created
December 4, 2012 06:25
-
-
Save tajo/4201256 to your computer and use it in GitHub Desktop.
Return to the position before expanding
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
<script> | |
function saveLoc(element){ | |
if(!element.getBoundingClientRect) return function(){}; | |
var top = element.getBoundingClientRect().top; | |
return function(){ | |
window.scrollBy(0, element.getBoundingClientRect().top - top); | |
}; | |
} | |
$(document).ready(function() { | |
$('.showcomm').on('click', function() { | |
var topic = $(this).closest('.topic'); | |
saveLoc(topic[0]); | |
topic.find('.comments-all, .comments-marked, .closecommin, .showcommin').slideToggle(); | |
return false; | |
}); | |
var keywords = {$highlightKeywords}; | |
var message = $('.message'); | |
for (var i = 0; i < keywords.length; i++) { | |
message.highlight(keywords[i]); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment