Show comments box when scrolling to annotation

This commit is contained in:
Amaia Castro
2017-01-10 18:21:16 +01:00
parent 329b288c01
commit f3daf2aca2

View File

@@ -25,7 +25,13 @@ App.LegislationAnnotatable =
anchor = $(location).attr('hash')
ann_id = anchor.split("-")[-1..]
el = $("span[data-annotation-id='" + ann_id + "']")
App.LegislationAllegations.show_comments()
$('html,body').animate({scrollTop: el.offset().top})
$.event.trigger
type: "renderLegislationAnnotation"
annotation_id: ann_id
annotation_url: el.closest(".legislation-annotatable").data("legislation-annotatable-base-url")
offset: el.offset()["top"]
initialize: ->
$(document).on("renderLegislationAnnotation", App.LegislationAnnotatable.renderAnnotationComments)