-
-
Save walidvb/e994801c9760684bc050 to your computer and use it in GitHub Desktop.
This file contains 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
computeElementsPositions = () -> | |
elements = new Array() | |
padding = parseInt $('body').css('paddingTop') | |
console.log 'computing elements with body padding of '+padding | |
$('.witness').remove() | |
$('[data-pid]').each () -> | |
$this = $(this) | |
pid = $this.attr("data-pid") | |
pos = $this.offset().top - padding | |
witness = $('<div class="witness">' + pid + ':' + pos + '</div>') | |
witness.css | |
top : pos | |
position : "absolute" | |
width : "100%" | |
"border-top" : "solid 1px red " | |
$('body').append witness | |
elements.push | |
'elem': $this | |
'pid' : pid | |
'pos' : pos | |
$scope.elements = elements |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment