Sha256: 756c2f8599c1b6431613f266649a7edf0842114d5a5ab78cd8b477d0086256a2

Contents?: true

Size: 1 KB

Versions: 14

Compression:

Stored size: 1 KB

Contents

<script type="text/javascript">

function svg_aug_contained_image(){

  var x_i = document.getElementsByClassName("image--guarantee")[0].offsetWidth ;
  var y_i = document.getElementsByClassName("image--guarantee")[0].offsetHeight ;
  /* ge scg labels */
  var svg = document.querySelectorAll('.svg__augment > .augment--guarantee');

  /* origanal image width in pixels */
  var x_0 = {{ page.guarantee.augment.image | split: ', ' | first }} ;
  var y_0 = {{ page.guarantee.augment.image | split: ', ' | last }} ;

  for (let i = 0; i < svg.length; i++) {
  /* origanal x position in pixels */
  var dx_0 = parseInt( svg[i].getAttribute('x'), 10 ) / 100 ;
  var dy_0 = parseInt( svg[i].getAttribute('y'), 10 ) / 100 ;

  var dx_0Pixel = dx_0 * x_0 ;
  var dy_0Pixel = dy_0 * y_0 ;

  svg[i].setAttribute("x", (dx_0Pixel - ( x_0 / 2) + (x_i / 2) ) / x_i * 100 + '%');
  svg[i].setAttribute("y", (dy_0Pixel - ( y_0 / 2) + (y_i / 2) ) / y_i * 100 + '%');
 };

}

//window.setInterval(svg_aug_contained_image, 200 )

</script>

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
slow-steps-0.2.1 _includes/functions/pull_page_args.html
slow-steps-0.2.0 _includes/functions/pull_page_args.html
slow-steps-0.1.13 _includes/functions/pull_page_args.html
slow-steps-0.1.12 _includes/functions/pull_page_args.html
slow-steps-0.1.11 _includes/functions/pull_page_args.html
slow-steps-0.1.10 _includes/functions/pull_page_args.html
slow-steps-0.1.9 _includes/functions/pull_page_args.html
slow-steps-0.1.8 _includes/functions/pull_page_args.html
slow-steps-0.1.7 _includes/functions/pull_page_args.html
slow-steps-0.1.6 _includes/functions/pull_page_args.html
slow-steps-0.1.5 _includes/functions/pull_page_args.html
slow-steps-0.1.4 _includes/functions/pull_page_args.html
slow-steps-0.1.3 _includes/functions/pull_page_args.html
slow-steps-0.1.2 _includes/functions/pull_page_args.html