Sha256: fc17320d97334c82612fb6153895d0171de164da248ad0052f5a38369b7eb608

Contents?: true

Size: 952 Bytes

Versions: 7

Compression:

Stored size: 952 Bytes

Contents

$(document).ready(function() {
  function setFrontHeight(element) {
    var height = element.height();
    element.css({ height: height + 'px' }).attr('data-original-height', height);
  }

  function removeFrontHeight(element) {
    element.css({ height: 'inherit' });
  }

  $('.assessment .flip-action').on('click', function() {
    $(this).closest('.assessment').addClass('flip');

    var front = $(this).closest('.front');
    setFrontHeight(front);

    var frontHeight = front.height();

    var back = $(this).closest('.front').next('.back');
    var backHeight = back.height();

    if (frontHeight > backHeight) {
      back.css({ height: '100%' });
    } else {
      front.css({ height: backHeight + 'px' });
    }
  });

  $('.assessment .flip-action-back').on('click', function() {
    var assessment = $(this).closest('.assessment').removeClass('flip');
    var front = assessment.find('.front');
    removeFrontHeight(front);
  });
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
woople-theme-0.2.34 app/assets/javascripts/assessment_flipper.js
woople-theme-0.2.33 app/assets/javascripts/assessment_flipper.js
woople-theme-0.2.32 app/assets/javascripts/assessment_flipper.js
woople-theme-0.2.31 app/assets/javascripts/assessment_flipper.js
woople-theme-0.2.30 app/assets/javascripts/assessment_flipper.js
woople-theme-0.2.29 app/assets/javascripts/assessment_flipper.js
woople-theme-0.2.28 app/assets/javascripts/assessment_flipper.js