aboutsummaryrefslogtreecommitdiffstats
path: root/web/cobrands/fixmystreet.com/js.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/cobrands/fixmystreet.com/js.js')
-rw-r--r--web/cobrands/fixmystreet.com/js.js53
1 files changed, 39 insertions, 14 deletions
diff --git a/web/cobrands/fixmystreet.com/js.js b/web/cobrands/fixmystreet.com/js.js
index b38df87ed..5aecd820e 100644
--- a/web/cobrands/fixmystreet.com/js.js
+++ b/web/cobrands/fixmystreet.com/js.js
@@ -36,20 +36,45 @@ $(function(){
});
$(function(){
- /* Accordion on councils page */
+ // "Fold out" additional rows in pricing grid
+ $('.js-extra-features').each(function(){
+ var $t3 = $(this);
+ var $t2 = $('<tbody>');
+ var cols = $t3.find('tr').eq(0).children().length;
- var allPanels = $('.accordion > .accordion-item .accordion-content').hide();
- var allSwitches = $('.accordion .accordion-switch');
+ $t2.addClass('pricing-table__show-more');
+ $t2.html('<tr><td colspan="' + cols + '"><button class="button">Compare more features</button></td></tr>');
+ $t2.on('click', '.button', function(){
+ $t3.toggle();
+ });
- allSwitches.click(function() {
- if ($(this).hasClass('accordion-switch--open')) {
- return false;
- }
- allPanels.slideUp();
- allSwitches.removeClass('accordion-switch--open');
- $(this).addClass('accordion-switch--open');
- $(this).next().slideDown();
- return false;
- });
- allSwitches.first().click();
+ $t2.insertBefore($t3);
+ $t3.hide();
+ });
+
+ // Add tier names to cells, to be displayed on narrow screens
+ $('.pricing-table thead th').each(function(){
+ var $table = $(this).parents('.pricing-table');
+ var colIndex = $(this).prevAll().length;
+
+ // Ignore first column
+ if (colIndex > 0) {
+ var tierName = $(this).text();
+ $table.find('tbody tr').each(function(){
+ $(this).children().eq(colIndex).attr('data-tier-name', tierName);
+ });
+ }
+ });
+
+ // Hide the demo access form behind a button, to save space on initial page load
+ $('.js-fms-pro-demo-form').each(function(){
+ var $form = $(this);
+ var $revealBtn = $('<button>').addClass('btn').text('Request access').on('click', function(){
+ $form.slideDown(250, function(){
+ $form.find('input[type="text"], input[type="text"]').eq(0).focus();
+ });
+ $(this).remove();
+ }).insertAfter($form);
+ $form.hide();
+ });
});