Counters
A0052
Code With ACF Integration
HTML
<!-- A0052 ------------------------------------------------> <?php if ( have_rows( 'a0052' ) ) : ?> <?php while ( have_rows( 'a0052' ) ) : the_row();?> <section id="a0052"> <div class="a0052-benefits"> <div class="a0052-benefits__inner"> <div class="a0052-benefits__element"> <h2><?php echo get_sub_field('header'); ?></h2> <h4><?php echo get_sub_field('sub_header'); ?></h4> </div> <div class="a0052-benefits__element"> <h2><span class="a0052-benefits__number"><?php echo get_sub_field('counter_1'); ?></span><?php echo get_sub_field('counter_1_after'); ?></h2 <p></p> <h4 class="a0052-subtitle"><?php echo get_sub_field('sub_title_1'); ?></h4> </div> <div class="a0052-benefits__element"> <h2><span class="a0052-benefits__number"><?php echo get_sub_field('counter_2'); ?></span><?php echo get_sub_field('counter_2_after'); ?></h2 <p></p> <h4><?php echo get_sub_field('sub_title_2'); ?></h4> </div> <div class="a0052-benefits__element"> <h2><span class="a0052-benefits__number"><?php echo get_sub_field('counter_3'); ?></span><?php echo get_sub_field('counter_3_after'); ?></h2 <p></p> <h4><?php echo get_sub_field('sub_title_3'); ?></h4> </div> <div class="a0052-benefits__element"> <h2><span class="a0052-benefits__number"><?php echo get_sub_field('counter_4'); ?></span><?php echo get_sub_field('counter_4_after'); ?></h2 <p></p> <h4><?php echo get_sub_field('sub_title_4'); ?></h4> </div> </div> </div> </section> <script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script> <script> !function(t){t.extend(t.easing,{spincrementEasing:function(t,a,e,n,r){return a===r?e+n:n*(-Math.pow(2,-10*a/r)+1)+e}}),t.fn.spincrement=function(a){function e(t,a){if(t=t.toFixed(a),a>0&&"."!==r.decimalPoint&&(t=t.replace(".",r.decimalPoint)),r.thousandSeparator)for(;o.test(t);)t=t.replace(o,"$1"+r.thousandSeparator+"$2");return t}var n={from:0,to:null,decimalPlaces:null,decimalPoint:".",thousandSeparator:",",duration:1e3,leeway:50,easing:"spincrementEasing",fade:!0,complete:null},r=t.extend(n,a),o=new RegExp(/^(-?[0-9]+)([0-9]{3})/);return this.each(function(){var a=t(this),n=r.from;a.attr("data-from")&&(n=parseFloat(a.attr("data-from")));var o;if(a.attr("data-to"))o=parseFloat(a.attr("data-to"));else if(null!==r.to)o=r.to;else{var i=t.inArray(r.thousandSeparator,["\\","^","$","*","+","?","."])>-1?"\\"+r.thousandSeparator:r.thousandSeparator,l=new RegExp(i,"g");o=parseFloat(a.text().replace(l,""))}var c=r.duration;r.leeway&&(c+=Math.round(r.duration*(2*Math.random()-1)*r.leeway/100));var s;if(a.attr("data-dp"))s=parseInt(a.attr("data-dp"),10);else if(null!==r.decimalPlaces)s=r.decimalPlaces;else{var d=a.text().indexOf(r.decimalPoint);s=d>-1?a.text().length-(d+1):0}a.css("counter",n),r.fade&&a.css("opacity",0),a.animate({counter:o,opacity:1},{easing:r.easing,duration:c,step:function(t){a.html(e(t*o,s))},complete:function(){a.css("counter",null),a.html(e(o,s)),r.complete&&r.complete(a)}})})}}(jQuery); $(document).ready(function () { var show = true; var countbox = ".a0052-benefits__inner"; $(window).on("scroll load resize", function () { if (!show) return false; // Отменяем показ анимации, если она уже была выполнена var w_top = $(window).scrollTop(); // Количество пикселей на которое была прокручена страница var e_top = $(countbox).offset().top; // Расстояние от блока со счетчиками до верха всего документа var w_height = $(window).height(); // Высота окна браузера var d_height = $(document).height(); // Высота всего документа var e_height = $(countbox).outerHeight(); // Полная высота блока со счетчиками if (w_top + 500 >= e_top || w_height + w_top == d_height || e_height + e_top < w_height) { $('.a0052-benefits__number').css('opacity', '1'); $('.a0052-benefits__number').spincrement({ thousandSeparator: "", duration: 1200 }); show = false; } }); }); </script> <?php endwhile; ?> <?php endif; ?> <!-- A0052 END ------------------------------------------------>
CSS
/* A0052 -------------------------------------------------------*/ #a0052{ background: rgba(84, 135, 85, 0.62); } .a0052-benefits__element h2 { font-family: Oswald; font-style: normal; font-weight: 500; font-size: 46px; line-height: 55px; text-align: center; color: #FFFFFF; } .a0052-benefits__inner { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr; width: fit-content; margin: auto; grid-gap: 20px; padding-top: 20px; padding-bottom: 20px; } .a0052-benefits__element h4 { font-family: Montserrat; font-style: normal; font-weight: 600; font-size: 20px; line-height: 24px; text-align: center; color: #FFFFFF; max-width: 225px; } .a0052-benefits__element p { margin-bottom: 0rem; } @media (max-width: 992px) { .a0052-benefits__inner { grid-template-columns: 1fr 1fr 1fr; grid-gap: 10px; } } @media (max-width: 576px) { .a0052-benefits__inner { grid-template-columns: 1fr; } } /* A0052 END -------------------------------------------------------*/
A0095
Code With ACF Integration
HTML
<!-- A0095 ------------------------------------------------> <?php $img = ""; if (have_rows('a0095-bg')) : ?> <?php while (have_rows('a0095-bg')) : the_row(); ?> <?php $img = get_sub_field('imagebg'); endwhile; ?> <?php endif; ?> <?php if (have_rows('a0095')) : ?> <section id="a0095" style="background-image: url('<?php echo $img; ?>')"> <div class="container"> <div class="row"> <div class="col-12"> <div class="a0095-benefits"> <div class="a0095-benefits__inner"> <?php while (have_rows('a0095')) : the_row(); ?> <div class="a0095-benefits__element"> <img src="<?php echo get_sub_field('image'); ?>"> <h2><?php echo get_sub_field('content_before'); ?><span class="a0095-benefits__number"><?php echo get_sub_field('counter'); ?></span><?php echo get_sub_field('counter_after'); ?> </h2 <p></p> <h4 class="a0095-subtitle"><?php echo get_sub_field('sub_title'); ?></h4> </div> <?php endwhile; ?> </div> </div> </div> </div> </div> </section> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> <script> !function (t) { t.extend(t.easing, { spincrementEasing: function (t, a, e, n, r) { return a === r ? e + n : n * (-Math.pow(2, -10 * a / r) + 1) + e } }), t.fn.spincrement = function (a) { function e(t, a) { if (t = t.toFixed(a), a > 0 && "." !== r.decimalPoint && (t = t.replace(".", r.decimalPoint)), r.thousandSeparator) for (; o.test(t);) t = t.replace(o, "$1" + r.thousandSeparator + "$2"); return t } var n = { from: 0, to: null, decimalPlaces: null, decimalPoint: ".", thousandSeparator: ",", duration: 1e3, leeway: 50, easing: "spincrementEasing", fade: !0, complete: null }, r = t.extend(n, a), o = new RegExp(/^(-?[0-9]+)([0-9]{3})/); return this.each(function () { var a = t(this), n = r.from; a.attr("data-from") && (n = parseFloat(a.attr("data-from"))); var o; if (a.attr("data-to")) o = parseFloat(a.attr("data-to")); else if (null !== r.to) o = r.to; else { var i = t.inArray(r.thousandSeparator, ["\\", "^", "$", "*", "+", "?", "."]) > -1 ? "\\" + r.thousandSeparator : r.thousandSeparator, l = new RegExp(i, "g"); o = parseFloat(a.text().replace(l, "")) } var c = r.duration; r.leeway && (c += Math.round(r.duration * (2 * Math.random() - 1) * r.leeway / 100)); var s; if (a.attr("data-dp")) s = parseInt(a.attr("data-dp"), 10); else if (null !== r.decimalPlaces) s = r.decimalPlaces; else { var d = a.text().indexOf(r.decimalPoint); s = d > -1 ? a.text().length - (d + 1) : 0 } a.css("counter", n), r.fade && a.css("opacity", 0), a.animate({ counter: o, opacity: 1 }, { easing: r.easing, duration: c, step: function (t) { a.html(e(t * o, s)) }, complete: function () { a.css("counter", null), a.html(e(o, s)), r.complete && r.complete(a) } }) }) } }(jQuery); $(document).ready(function () { var show = true; var countbox = ".a0095-benefits__inner"; $(window).on("scroll load resize", function () { if (!show) return false; // Отменяем показ анимации, если она уже была выполнена var w_top = $(window).scrollTop(); // Количество пикселей на которое была прокручена страница var e_top = $(countbox).offset().top; // Расстояние от блока со счетчиками до верха всего документа var w_height = $(window).height(); // Высота окна браузера var d_height = $(document).height(); // Высота всего документа var e_height = $(countbox).outerHeight(); // Полная высота блока со счетчиками if (w_top + 500 >= e_top || w_height + w_top == d_height || e_height + e_top < w_height) { $('.a0095-benefits__number').css('opacity', '1'); $('.a0095-benefits__number').spincrement({ thousandSeparator: "", duration: 3200 }); show = false; } }); }); </script> <?php endif; ?> <!-- A0095 END ------------------------------------------------>
CSS
/* A0095 -------------------------------------------------------*/ #a0095 { background-repeat: no-repeat; background-size: cover !important; background: rgba(84, 135, 85, 0.62); padding-top: 20px; padding-bottom: 20px; } .a0095-benefits__element h2 { font-family: Oswald; font-style: normal; font-weight: 300; font-size: 48px; line-height: 71px; text-align: center; text-transform: uppercase; color: #DAA521; } .a0095-benefits__inner { display: grid; grid-template-columns: repeat( auto-fit, minmax(250px, 1fr) ); width: 100%; margin: auto; grid-gap: 20px; padding-top: 20px; padding-bottom: 20px; justify-items: center; } .a0095-benefits__element h4 { max-width: 225px; font-family: Merriweather; font-style: normal; font-weight: normal; font-size: 24px; line-height: 30px; text-align: center; color: #FFFFFF; } .a0095-benefits__element { background: rgba(0, 0, 0, 0.7); width: 100%; display: grid; justify-items: center; padding: 0px 46px; padding-top: 30px; padding-bottom: 20px; max-width: 260px; margin-left: auto; margin-right: auto; } .a0095-benefits__element p { margin-bottom: 0rem; } @media (max-width: 992px) { } /* A0095 END -------------------------------------------------------*/
A0113
Code With ACF Integration
HTML
<!-- A0113 ------------------------------------------------> <?php if ( have_rows( 'a0113' ) ) : ?> <?php while ( have_rows( 'a0113' ) ) : the_row();?> <section id="a0113" style="overflow: hidden"> <div class="container"> <div class="row"> <div class="col-12"> <div class="a0113-benefits"> <div class="a0113-benefits__inner"> <div class="a0113-benefits__element"> <h2><span class="a0113-benefits__number"><?php echo get_sub_field('counter_1'); ?></span><?php echo get_sub_field('counter_1_after'); ?></h2 <p></p> <h4 class="a0113-subtitle"><?php echo get_sub_field('sub_title_1'); ?></h4> </div> <div class="a0113-benefits__element"> <h2><span class="a0113-benefits__number"><?php echo get_sub_field('counter_2'); ?></span><?php echo get_sub_field('counter_2_after'); ?></h2 <p></p> <h4><?php echo get_sub_field('sub_title_2'); ?></h4> </div> <div class="a0113-benefits__element"> <h2><span class="a0113-benefits__number"><?php echo get_sub_field('counter_3'); ?></span><?php echo get_sub_field('counter_3_after'); ?></h2 <p></p> <h4><?php echo get_sub_field('sub_title_3'); ?></h4> </div> <div class="a0113-benefits__element"> <h2><span class="a0113-benefits__number"><?php echo get_sub_field('counter_4'); ?></span><?php echo get_sub_field('counter_4_after'); ?></h2 <p></p> <h4><?php echo get_sub_field('sub_title_4'); ?></h4> </div> </div> </div> </div> </div> </div> </section> <script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script> <script> !function(t){t.extend(t.easing,{spincrementEasing:function(t,a,e,n,r){return a===r?e+n:n*(-Math.pow(2,-10*a/r)+1)+e}}),t.fn.spincrement=function(a){function e(t,a){if(t=t.toFixed(a),a>0&&"."!==r.decimalPoint&&(t=t.replace(".",r.decimalPoint)),r.thousandSeparator)for(;o.test(t);)t=t.replace(o,"$1"+r.thousandSeparator+"$2");return t}var n={from:0,to:null,decimalPlaces:null,decimalPoint:".",thousandSeparator:",",duration:1e3,leeway:50,easing:"spincrementEasing",fade:!0,complete:null},r=t.extend(n,a),o=new RegExp(/^(-?[0-9]+)([0-9]{3})/);return this.each(function(){var a=t(this),n=r.from;a.attr("data-from")&&(n=parseFloat(a.attr("data-from")));var o;if(a.attr("data-to"))o=parseFloat(a.attr("data-to"));else if(null!==r.to)o=r.to;else{var i=t.inArray(r.thousandSeparator,["\\","^","$","*","+","?","."])>-1?"\\"+r.thousandSeparator:r.thousandSeparator,l=new RegExp(i,"g");o=parseFloat(a.text().replace(l,""))}var c=r.duration;r.leeway&&(c+=Math.round(r.duration*(2*Math.random()-1)*r.leeway/100));var s;if(a.attr("data-dp"))s=parseInt(a.attr("data-dp"),10);else if(null!==r.decimalPlaces)s=r.decimalPlaces;else{var d=a.text().indexOf(r.decimalPoint);s=d>-1?a.text().length-(d+1):0}a.css("counter",n),r.fade&&a.css("opacity",0),a.animate({counter:o,opacity:1},{easing:r.easing,duration:c,step:function(t){a.html(e(t*o,s))},complete:function(){a.css("counter",null),a.html(e(o,s)),r.complete&&r.complete(a)}})})}}(jQuery); $(document).ready(function () { var show = true; var countbox = ".a0113-benefits__inner"; $(window).on("scroll load resize", function () { if (!show) return false; var w_top = $(window).scrollTop(); var e_top = $(countbox).offset().top; var w_height = $(window).height(); var d_height = $(document).height(); var e_height = $(countbox).outerHeight(); if (w_top + 500 >= e_top || w_height + w_top == d_height || e_height + e_top < w_height) { $('.a0113-benefits__number').css('opacity', '1'); $('.a0113-benefits__number').spincrement({ thousandSeparator: "", duration: 1200 }); show = false; } }); }); </script> <?php endwhile; ?> <?php endif; ?> <!-- A0113 END ------------------------------------------------>
CSS
/* A0113 -------------------------------------------------------*/ #a0113 { padding: 40px 0px; background: #3A4750; } .a0113-benefits__element h2 { font-family: Scada; font-style: normal; font-weight: normal; font-size: 72px; line-height: 100%; align-items: center; text-align: center; color: #FFFFFF; } .a0113-benefits__inner { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; width: 100%; margin: auto; grid-gap: 20px; padding-top: 20px; padding-bottom: 20px; } .a0113-benefits__element h4 { max-width: 100%; font-family: Scada; font-style: normal; font-weight: normal; font-size: 18px; line-height: 100%; text-align: center; color: #FFFFFF; } .a0113-benefits__element p { margin-bottom: 0rem; } @media (max-width: 992px) { .a0113-benefits__inner { grid-template-columns: 1fr 1fr; grid-gap: 40px 10px; } } @media (max-width: 576px) { .a0113-benefits__inner { grid-template-columns: 1fr; } } /* A0113 END -------------------------------------------------------*/