3596 - Срочно (Важно) - Замена страницы

parent 82d1d10a
<?php
namespace frontend\assets;
use yii\web\AssetBundle;
/**
* Class BusinessSolutionsAsset
* @package frontend\assets
*/
class BusinessSolutionsAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/business_solutions.css',
'plugins/tooltipster-master/tooltipster.css'
];
public $js = [
'plugins/tooltipster-master/jquery.tooltipster.js',
'js/anchor.js',
'js/jquery.appear.js',
'js/animatedContent.js',
];
public $depends = [
'frontend\assets\AppAsset',
];
}
\ No newline at end of file
......@@ -58,13 +58,13 @@ return [
'cache' => [
'class' => 'yii\caching\FileCache',
],
'view' => [
'class' => 'rmrevin\yii\minify\View',
'base_path' => '@app/web',
'minify_path' => '@app/web/minify',
'force_charset' => 'UTF-8',
'expand_imports' => true,
],
// 'view' => [
// 'class' => 'rmrevin\yii\minify\View',
// 'base_path' => '@app/web',
// 'minify_path' => '@app/web/minify',
// 'force_charset' => 'UTF-8',
// 'expand_imports' => true,
// ],
'user' => [
'identityClass' => 'common\modules\users\models\User',
'identityCookie' => [
......
.bs_content {
font-family: "RobotoRegular" !important;
color: #0a0a0a !important;
font-size: 17px;
line-height: 28px;
}
.bs_content p:not(:last-child) {
margin-bottom: 10px;
}
.bs_sec {
width: 100%;
background: #fff;
}
.bs_content h1,
.bs_content h2,
.bs_content h3,
.bs_content h4,
.bs_content h5,
.bs_content h6 {
font-family: "RobotoRegular" !important;
color: #444444 !important;
font-weight: bold;
}
.bs_content h1 {
font-size: 31px;
line-height: 47px;
margin-bottom: 40px;
}
.bs_content h2 {
font-size: 24px;
line-height: 34px;
margin-bottom: 15px;
}
.bs_content h3 {
font-size: 30px;
line-height: 47px;
margin-bottom: 45px;
color: #243340;
font-weight: normal;
}
.bs_content *[data-lnumber] {
position: relative;
padding-left: 52px;
}
.bs_content *[data-lnumber]:after {
content: attr(data-lnumber);
position: absolute;
top: 8px;
left: 0;
width: 33px;
height: 31px;
text-align: center;
line-height: 31px;
background: url(../images/business_solutions/data-number_bg.png) 0 0 no-repeat;
font-size: 18px;
color: #ffffff;
font-weight: bold;
}
.bs_content h4 {
font-size: 24px;
line-height: 34px;
margin-bottom: 15px;
}
.bs_content h4 a {
color: #444444;
border-bottom: 1px solid #dadada;
}
.bs_content h4 a:hover {
color: #009ad4;
border-bottom: 1px solid transparent;
}
.container_offset {
padding-top: 55px;
padding-bottom: 55px;
}
.list_anchor {
list-style-type: disc;
padding-left: 20px;
}
.list_anchor li {
color: #009ad4;
}
.list_anchor a {
display: block;
color: #009ad4;
text-decoration: none;
font-size: 17px;
line-height: 28px;
margin-bottom: 10px;
}
.list_anchor li:hover,
.list_anchor li:hover a{
color: #323232;
}
.bs_top_box {
position: relative;
}
.bs_top_img {
position: absolute;
top: 60px;
left: 15px;
right: -15px;
z-index: 0;
}
.bs_top_img ~ * {
position: relative;
z-index: 2;
}
.bs_top_img img {
max-width: 100%;
height: auto;
}
.bs_top_box_left {
width: 50%;
}
.title_bs_pos {
position: absolute;
right: 15px;
top: 150px;
}
.title_bs {
font-size: 30px;
line-height: 47px;
}
.title_bs span {
color: #fff;
display: inline-block;
padding: 0px 15px 3px 15px;
margin-bottom: 6px;
background: #2d323a;
}
.bs_logo_art {
margin-bottom: 40px;
}
.bs_item:not(:last-child) {
margin-bottom: 50px;
}
.bs_btn_yellow {
display: inline-block;
border-radius: 3px;
box-shadow: 0px 3px 13px 0px rgb( 233, 196, 25 );
border:none;
background-color: #fdd104;
background-color: rgb( 253, 209, 4 );
text-align: center;
font-size: 16px;
line-height: 24px;
color: #444;
padding: 10px 15px;
min-width: 170px;
}
.bs_btn_yellow:hover{
background-color: #fdda35;
box-shadow: 0px 1px 3px 0px rgb( 233, 196, 25 );
}
.bs_btn_transparent {
display: inline-block;
border-radius: 3px;
border: 1px solid rgb( 55, 72, 78, 0.3 );
background-color: transparent;
text-align: center;
font-size: 16px;
line-height: 24px;
color: #243340;
padding: 9px 15px;
min-width: 170px;
}
.bs_btn_transparent:hover{
background-color: rgb( 55, 72, 78, 0.1 );
}
.bs_btn_icon_eye {
padding-left: 45px;
background: url(../images/business_solutions/icon_eye.svg) 15px center no-repeat;
}
.bs_btn_icon_doc {
padding-left: 45px;
background: url(../images/business_solutions/icon_doc.svg) 15px center no-repeat;
}
.bs_btn_green {
display: inline-block;
border-radius: 3px;
background-color: rgb( 103, 172, 29 );
box-shadow: 0px 3px 13px 0px rgb( 95, 162, 24 );
border:none;
text-align: center;
font-size: 16px;
line-height: 24px;
color: #ffffff;
padding: 10px 15px;
min-width: 170px;
}
.bs_btn_green:hover{
color: #ffffff;
background-color: #73b42e;
box-shadow: 0px 1px 3px 0px rgb( 95, 162, 24 );
}
.txt_info {
position: relative;
cursor: pointer;
display: inline-block;
color: #009ad4;
text-decoration: none;
font-size: 17px;
line-height: 24px;
padding-left: 30px;
padding-top: 10px;
padding-bottom: 10px;
}
.txt_info span {
border-bottom: 1px dotted #b1cbd5;
}
.txt_info::before {
content: "";
position: absolute;
width: 18px;
height: 18px;
top: 15px;
left: 3px;
background: url(../images/business_solutions/icon_info.svg) 0 0 no-repeat;
}
.txt_info:hover {
color: #323232;
}
.txt_info:hover span {
border-bottom: 1px dotted transparent;
}
.txt_info:hover::before {
background: url(../images/business_solutions/icon_info_hover.svg) 0 0 no-repeat;
}
.tooltip_list,
.tooltip_cont {
font-size: 14px;
line-height: 24px;
padding: 12px 14px;
}
.bs_btn_wr {
padding-top: 15px;
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-o-align-items: center;
align-items: center;
-webkit-justify-content: space-between;
-moz-justify-content: space-between;
-ms-justify-content: space-between;
-o-justify-content: space-between;
justify-content: space-between;
-webkit-flex-wrap: wrap;
-moz-flex-wrap: wrap;
-ms-flex-wrap: wrap;
-o-flex-wrap: wrap;
flex-wrap: wrap;
}
.bs_btn_wr>* {
margin-bottom: 10px;
}
.bs_item_img {
text-align: right;
margin-right: -15px;
}
.bs_item_img img {
display: inline-block;
}
section[id*="box"]:nth-child(2n) {
background-color: #e2f8e6;
}
section[id*="box"]:nth-child(3n) {
background-color: #f8f2e2;
}
section[id*="box"]:nth-child(4n) {
background-color: #e2f4f8;
}
section[id*="box"]:nth-child(5n) {
background-color: #e4ecfa;
}
section[id*="box"]:nth-child(6n) {
background-color: #ffffff;
}
section[id*="box"]:nth-child(7n) {
background-color: #e2f8e6;
}
section[id*="box"]:nth-child(8n) {
background-color: #f8f2e2;
}
section[id*="box"]:nth-child(9n) {
background-color: #e2f4f8;
}
section[id*="box"]:nth-child(10n) {
background-color: #e4ecfa;
}
section[id*="box"]:nth-child(11n) {
background-color: #ffffff;
}
section[id*="box"]:nth-child(12n) {
background-color: #e2f8e6;
}
section[id*="box"]:nth-child(13n) {
background-color: #f8f2e2;
}
section[id*="box"]:nth-child(14n) {
background-color: #e2f4f8;
}
section[id*="box"]:nth-child(15n) {
background-color: #e4ecfa;
}
section[id*="box"]:nth-child(16n) {
background-color: #ffffff;
}
.yandex_box {
font-size: 17px;
line-height: 28px;
font-weight: bold;
color: #444444;
background-color: #f3f5f7;
padding: 20px 30px 15px 30px;
border-radius: 3px
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
-webkit-justify-content: space-between;
-moz-justify-content: space-between;
-ms-justify-content: space-between;
-o-justify-content: space-between;
justify-content: space-between;
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-o-align-items: center;
align-items: center;
margin-right: 50px;
}
.transparent{ opacity:0; }
.black_and_white {
-webkit-animation-duration: 1s;
-o-animation-duration: 1s;
animation-duration: 1s;
-webkit-transition: all 1s;
-o-transition: all 1s;
transition: all 1s;
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(100%);
filter: gray; /* IE 6-9 */
}
.colored {
-webkit-filter: grayscale(0%);
-moz-filter: grayscale(0%);
-ms-filter: grayscale(0%);
-o-filter: grayscale(0%);
filter: grayscale(0%);
filter: none; /* IE 6-9 */
}
@media only screen and (max-width: 992px) {
.yandex_box {
margin-right: 0;
padding: 20px 20px 15px 20px;
}
}
@media only screen and (max-width: 767px) {
.container_offset {
padding-top: 35px;
padding-bottom: 35px;
}
.bs_top_img {
position: relative;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.bs_top_img {
display: none;
}
.title_bs_pos {
position: static;
}
.bs_top_box_left {
width: 100%;
}
.bs_content h3 {
line-height: 38px;
}
.bs_content *[data-lnumber]:after {
top: 5px;
}
.bs_item:not(:last-child) {
margin-bottom: 20px;
}
.bs_item_img {
display: none;
}
.yandex_box {
margin-right: 0;
-webkit-flex-wrap: wrap;
-moz-flex-wrap: wrap;
-ms-flex-wrap: wrap;
-o-flex-wrap: wrap;
flex-wrap: wrap;
padding: 20px 15px 15px 15px;
}
.yandex_box p {
margin-bottom: 10px;
}
.yandex_box br {
display: none;
}
}
<!-- Generator: Adobe Illustrator 19.0.1, SVG Export Plug-In -->
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="14px" height="17px" viewBox="0 0 14 17" style="enable-background:new 0 0 14 17;" xml:space="preserve">
<style type="text/css">
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#243340;}
</style>
<defs>
</defs>
<g id="Shape_669_2_">
<g>
<path class="st0" d="M12.5,3.4V0H0v15.6h0.9V0.9h9L12.5,3.4z M9.7,1.4H1.5V17H14V5.5L9.7,1.4z M4.1,4.8H7c0.2,0,0.3,0.1,0.3,0.3
c0,0.2-0.1,0.3-0.3,0.3H4.1c-0.2,0-0.3-0.1-0.3-0.3C3.8,4.9,3.9,4.8,4.1,4.8z M11.4,14.5H4.1c-0.2,0-0.3-0.1-0.3-0.3
c0-0.2,0.1-0.3,0.3-0.3h7.3c0.2,0,0.3,0.1,0.3,0.3C11.7,14.3,11.5,14.5,11.4,14.5z M11.4,12.2H4.1c-0.2,0-0.3-0.1-0.3-0.3
c0-0.2,0.1-0.3,0.3-0.3h7.3c0.2,0,0.3,0.1,0.3,0.3C11.7,12.1,11.5,12.2,11.4,12.2z M11.4,9.9H4.1c-0.2,0-0.3-0.1-0.3-0.3
s0.1-0.3,0.3-0.3h7.3c0.2,0,0.3,0.1,0.3,0.3S11.5,9.9,11.4,9.9z M11.4,7.7H4.1c-0.2,0-0.3-0.1-0.3-0.3c0-0.2,0.1-0.3,0.3-0.3h7.3
c0.2,0,0.3,0.1,0.3,0.3C11.7,7.5,11.5,7.7,11.4,7.7z M9.3,5.9V2l4.1,4H9.3z"/>
</g>
</g>
</svg>
<!-- Generator: Adobe Illustrator 19.0.1, SVG Export Plug-In -->
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="17px" height="9px" viewBox="0 0 17 9" style="enable-background:new 0 0 17 9;" xml:space="preserve">
<style type="text/css">
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#243340;}
</style>
<defs>
</defs>
<g id="Shape_2_1_">
<g>
<path class="st0" d="M8.5,2.4C7.9,2.4,7.4,2.6,7,3l1.1,1.2L6.4,3.9C6.4,4.1,6.4,4.3,6.4,4.5c0,1.2,1,2.1,2.1,2.1
c1.2,0,2.1-0.9,2.1-2.1C10.6,3.3,9.7,2.4,8.5,2.4z M16.7,4.1c0,0-0.9-1.1-2.3-2.1C12.6,0.7,10.5,0,8.5,0c-2,0-4.1,0.7-5.9,2.1
c-1.4,1-2.2,2-2.3,2.1L0,4.5l0.3,0.4c0,0,0.9,1.1,2.3,2.1C4.4,8.3,6.5,9,8.5,9s4.1-0.7,5.9-2.1c1.4-1,2.2-2,2.3-2.1L17,4.5
L16.7,4.1z M8.5,7.7c-1.8,0-3.2-1.4-3.2-3.2c0-0.3,0-0.5,0.1-0.8L4.6,3.6C4.6,3.9,4.5,4.2,4.5,4.5c0,1.1,0.5,2.1,1.3,2.8
C4.8,7,3.9,6.5,3.3,6C2.5,5.4,1.9,4.9,1.6,4.5C1.9,4.1,2.5,3.6,3.3,3c0.6-0.5,1.5-1,2.5-1.3l0.5,0.5c0.6-0.5,1.4-0.9,2.2-0.9
c1.8,0,3.2,1.4,3.2,3.2S10.3,7.7,8.5,7.7z M13.7,6c-0.6,0.5-1.5,1-2.5,1.3c0.8-0.7,1.3-1.7,1.3-2.8c0-1.1-0.5-2.1-1.3-2.8
c1,0.4,1.9,0.9,2.5,1.3c0.8,0.6,1.4,1.1,1.7,1.5C15.1,4.9,14.5,5.4,13.7,6z"/>
</g>
</g>
</svg>
<!-- Generator: Adobe Illustrator 19.0.1, SVG Export Plug-In -->
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="17px" height="17px" viewBox="0 0 17 17" style="enable-background:new 0 0 17 17;" xml:space="preserve">
<style type="text/css">
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#26A2D7;}
</style>
<defs>
</defs>
<g id="Shape_1_1_">
<g>
<path class="st0" d="M7.7,13.3h1.3v-1.3H7.7V13.3z M8.5,3.7c-0.8,0-1.4,0.2-1.9,0.6c-0.5,0.4-0.7,1.3-0.7,2l0,0h1.2
c0-0.4,0.1-1,0.4-1.2c0.3-0.2,0.6-0.3,1-0.3c0.5,0,0.8,0.1,1,0.4c0.2,0.2,0.4,0.6,0.4,1.1c0,0.4-0.1,0.7-0.3,1
C9.4,7.5,9.1,7.9,8.7,8.4C8.3,8.8,8,9.1,7.9,9.3C7.8,9.6,7.7,10,7.7,10.6H9c0-0.4,0-0.7,0.1-0.9c0-0.2,0.2-0.4,0.4-0.6
c0.5-0.5,0.9-1,1.2-1.4c0.3-0.5,0.5-1,0.5-1.5c0-0.8-0.2-1.4-0.7-1.8C10,3.9,9.3,3.7,8.5,3.7z M8.5,0C3.8,0,0,3.8,0,8.5
C0,13.2,3.8,17,8.5,17c4.7,0,8.5-3.8,8.5-8.5C17,3.8,13.2,0,8.5,0z M8.5,16c-4.1,0-7.4-3.4-7.4-7.5c0-4.1,3.3-7.4,7.4-7.4
c4.1,0,7.4,3.3,7.4,7.4C15.9,12.6,12.6,16,8.5,16z"/>
</g>
</g>
</svg>
<!-- Generator: Adobe Illustrator 19.0.1, SVG Export Plug-In -->
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="17px" height="17px" viewBox="0 0 17 17" style="enable-background:new 0 0 17 17;" xml:space="preserve">
<style type="text/css">
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#323232;}
</style>
<defs>
</defs>
<g id="Shape_1_1_">
<g>
<path class="st0" d="M7.7,13.3h1.3v-1.3H7.7V13.3z M8.5,3.7c-0.8,0-1.4,0.2-1.9,0.6c-0.5,0.4-0.7,1.3-0.7,2l0,0h1.2
c0-0.4,0.1-1,0.4-1.2c0.3-0.2,0.6-0.3,1-0.3c0.5,0,0.8,0.1,1,0.4c0.2,0.2,0.4,0.6,0.4,1.1c0,0.4-0.1,0.7-0.3,1
C9.4,7.5,9.1,7.9,8.7,8.4C8.3,8.8,8,9.1,7.9,9.3C7.8,9.6,7.7,10,7.7,10.6H9c0-0.4,0-0.7,0.1-0.9c0-0.2,0.2-0.4,0.4-0.6
c0.5-0.5,0.9-1,1.2-1.4c0.3-0.5,0.5-1,0.5-1.5c0-0.8-0.2-1.4-0.7-1.8C10,3.9,9.3,3.7,8.5,3.7z M8.5,0C3.8,0,0,3.8,0,8.5
C0,13.2,3.8,17,8.5,17c4.7,0,8.5-3.8,8.5-8.5C17,3.8,13.2,0,8.5,0z M8.5,16c-4.1,0-7.4-3.4-7.4-7.5c0-4.1,3.3-7.4,7.4-7.4
c4.1,0,7.4,3.3,7.4,7.4C15.9,12.6,12.6,16,8.5,16z"/>
</g>
</g>
</svg>
$(document).ready(function(){
$(".list_anchor").on("click","a", function (event) {
//отменяем стандартную обработку нажатия по ссылке
event.preventDefault();
//забираем идентификатор бока с атрибута href
var id = $(this).attr('href'),
//узнаем высоту от начала страницы до блока на который ссылается якорь
top = $(id).offset().top;
//анимируем переход на расстояние - top за 1500 мс
$('body,html').animate({scrollTop: top}, 800);
});
});
\ No newline at end of file
if($(window).width() > 767) {
$(document).ready(function() {
$('.tooltips').tooltipster({
contentAsHTML: true,
maxWidth: 490,
// trigger: 'click'
// interactive: true
});
});
}
else {
$(document).ready(function() {
$('.tooltips').tooltipster({
contentAsHTML: true,
maxWidth: 490,
trigger: 'click'
// interactive: true
});
});
}
$(document).ready(function(){
$("[data-animation]").each(function() {
var $this = $(this);
if($(window).width() > 767) {
$this.appear(function() {
var delay = ($this.attr("data-animation-delay") ? $this.attr("data-animation-delay") : 1);
if(delay > 1) $this.css("animation-delay", delay + "ms");
$this.removeClass('transparent').addClass("visible " + $this.attr("data-animation"));
}, {accX: 0, accY: -100});
}
else {
$this.removeClass("transparent").addClass("visible");
}
});
});
\ No newline at end of file
/* appear.min.js 0.0.14 */
appear=function(){"use strict";function e(){var e=window.scrollY||window.pageYOffset;null!=n&&(o.velocity=e-n,o.delta=o.velocity>=0?o.velocity:-1*o.velocity),n=e,i&&clearTimeout(i),i=setTimeout(function(){n=null},30)}function t(e,t){var n=e.getBoundingClientRect();return n.top+n.height>=0&&n.left+n.width>=0&&n.bottom-n.height<=(window.innerHeight||document.documentElement.clientHeight)+t&&n.right-n.width<=(window.innerWidth||document.documentElement.clientWidth)+t}var n=null,i=0,o={};return addEventListener("scroll",e),function(e){return function(){function e(e,t){return function(){var n=this,i=arguments;clearTimeout(c),c=setTimeout(function(){e.apply(n,i)},t)}}function n(){o.delta<w.delta.speed&&(l||(l=!0,u(),setTimeout(function(){l=!1},w.delta.timeout))),e(function(){u()},w.debounce)()}function i(){u(),addEventListener("scroll",n),addEventListener("resize",n)}function r(){m=[],c&&clearTimeout(c),a()}function a(){removeEventListener("scroll",n),removeEventListener("resize",n)}function u(){s||(m.forEach(function(e,n){e&&t(e,w.bounds)?v[n]&&(v[n]=!1,h++,w.appear&&w.appear(e),w.disappear||w.reappear||(m[n]=null)):(v[n]===!1&&(w.disappear&&w.disappear(e),g++,w.reappear||(m[n]=null)),v[n]=!0)}),w.reappear||w.appear&&(!w.appear||h!==p)||w.disappear&&(!w.disappear||g!==p)||(s=!0,a(),w.done&&w.done()))}function d(){if(!f){f=!0,w.init&&w.init();var e;if(e="function"==typeof w.elements?w.elements():w.elements){p=e.length;for(var t=0;p>t;t+=1)m.push(e[t]),v.push(!0);i()}}}var p,c,l,s,f=!1,m=[],v=[],h=0,g=0,w={};return function(e){return e=e||{},w={init:e.init,elements:e.elements,appear:e.appear,disappear:e.disappear,done:e.done,reappear:e.reappear,bounds:e.bounds||0,debounce:e.debounce||50,delta:{speed:e.deltaSpeed||50,timeout:e.deltaTimeout||500}},addEventListener("DOMContentLoaded",d),"complete"===document.readyState&&d(),{trigger:function(){u()},pause:function(){a()},resume:function(){i()},destroy:function(){r()}}}}()(e)}}();
$(function() {
appear({
init: function init(){
// console.log('dom is ready');
},
elements: function elements(){
return $('#calc')
},
appear: function appear(el){
$('#calc').addClass('calc-animate');
},
disappear: function disappear(el){
$('#calc').removeClass('calc-animate');
},
bounds: -550,
reappear: true
});
});
\ No newline at end of file
/*
* jQuery.appear
* https://github.com/bas2k/jquery.appear/
* http://code.google.com/p/jquery-appear/
* http://bas2k.ru/
*
* Copyright (c) 2009 Michael Hixson
* Copyright (c) 2012-2014 Alexander Brovikov
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
*/
(function($) {
$.fn.appear = function(fn, options) {
var settings = $.extend({
//arbitrary data to pass to fn
data: undefined,
//call fn only on the first appear?
one: true,
// X & Y accuracy
accX: 0,
accY: 0
}, options);
return this.each(function() {
var t = $(this);
//whether the element is currently visible
t.appeared = false;
if (!fn) {
//trigger the custom event
t.trigger('appear', settings.data);
return;
}
var w = $(window);
//fires the appear event when appropriate
var check = function() {
//is the element hidden?
if (!t.is(':visible')) {
//it became hidden
t.appeared = false;
return;
}
//is the element inside the visible window?
var a = w.scrollLeft();
var b = w.scrollTop();
var o = t.offset();
var x = o.left;
var y = o.top;
var ax = settings.accX;
var ay = settings.accY;
var th = t.height();
var wh = w.height();
var tw = t.width();
var ww = w.width();
if (y + th + ay >= b &&
y <= b + wh + ay &&
x + tw + ax >= a &&
x <= a + ww + ax) {
//trigger the custom event
if (!t.appeared) t.trigger('appear', settings.data);
} else {
//it scrolled out of view
t.appeared = false;
}
};
//create a modified fn with some additional logic
var modifiedFn = function() {
//mark the element as visible
t.appeared = true;
//is this supposed to happen only once?
if (settings.one) {
//remove the check
w.unbind('scroll', check);
var i = $.inArray(check, $.fn.appear.checks);
if (i >= 0) $.fn.appear.checks.splice(i, 1);
}
//trigger the original fn
fn.apply(this, arguments);
};
//bind the modified fn to the element
if (settings.one) t.one('appear', settings.data, modifiedFn);
else t.bind('appear', settings.data, modifiedFn);
//check whenever the window scrolls
w.scroll(check);
//check whenever the dom changes
$.fn.appear.checks.push(check);
//check now
(check)();
});
};
//keep a queue of appearance checks
$.extend($.fn.appear, {
checks: [],
timeout: null,
//process the queue
checkAll: function() {
var length = $.fn.appear.checks.length;
if (length > 0) while (length--) ($.fn.appear.checks[length])();
},
//check the queue asynchronously
run: function() {
if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout);
$.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20);
}
});
//run checks when these methods are called
$.each(['append', 'prepend', 'after', 'before', 'attr',
'removeAttr', 'addClass', 'removeClass', 'toggleClass',
'remove', 'css', 'show', 'hide'], function(i, n) {
var old = $.fn[n];
if (old) {
$.fn[n] = function() {
var r = old.apply(this, arguments);
$.fn.appear.run();
return r;
}
}
});
})(jQuery);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment