PageSourceSearch

https://www.ab-inmobiliaria.es/js/layout.js

js ab-inmobiliaria.es collected 2026-10-08 13:26:19 UTC 5,652 bytes, 170 lines download raw bytes

1var Layout = function () {
2    
3    // detect mobile device
4    var isMobileDevice = function() {
5        return  ((
6            navigator.userAgent.match(/Android/i) ||
7            navigator.userAgent.match(/BlackBerry/i) ||
8            navigator.userAgent.match(/iPhone|iPad|iPod/i) ||
9            navigator.userAgent.match(/Opera Mini/i) ||
10            navigator.userAgent.match(/IEMobile/i)
11        ) ? true : false);
12    }
13
14    // handle on page scroll
15    var handleHeaderOnScroll = function() {
16        if ($(window).scrollTop() > 60) {
17            $("body").addClass("page-on-scroll");
18        } else {
19            $("body").removeClass("page-on-scroll");
20        }
21    }
22
23    // Handle Header
24    var handleOnePageHeader = function() {
25        // jQuery to collapse the navbar on scroll
26        if ($('.navbar').offset().top > 150) {
27            $('.navbar-fixed-top').addClass('top-nav-collapse');
28        }
29        $(window).scroll(function() {
30            if ($('.navbar').offset().top > 150) {
31                $('.navbar-fixed-top').addClass('top-nav-collapse');
32            } else {
33                $('.navbar-fixed-top').removeClass('top-nav-collapse');
34            }
35        });
36
37        var $offset = 0;
38        $offset = $(".navbar-fixed-top").height()-20;
39        
40        // jQuery for page scrolling feature - requires jQuery Easing plugin
41        $('.js_nav-item a').bind('click', function(event) {
42            var $position = $($(this).attr('href')).offset().top;
43            $('html, body').stop().animate({
44                scrollTop: $position - $offset
45            }, 600);
46            event.preventDefault();
47        });
48
49        var $scrollspy = $('body').scrollspy({target: '.navbar-fixed-top', offset: $offset+2});
50
51        // Collapse Navbar When It's Clickicked
52        $(window).scroll(function() {
53            $('.navbar-collapse.in').collapse('hide');
54        });
55    }
56
57    // handle carousel
58    var handleCarousel = function() {
59        var $item = $('.carousel .item'); 
60        var $wHeight = $(window).height();
61        $item.eq(0).addClass('active');
62        $item.height($wHeight); 
63        $item.addClass('full-screen');
64
65        $('.carousel img').each(function() {
66            var $src = $(this).attr('src');
67            var $color = $(this).attr('data-color');
68            $(this).parent().css({
69                'background-image' : 'url(' + $src + ')',
70                'background-color' : $color
71            });
72            $(this).remove();
73        });
74
75        $(window).on('resize', function (){
76            $wHeight = $(window).height();
77            $item.height($wHeight);
78        });
79    }
80
81    // handle group element heights
82    var handleHeight = function() {
83       $('[data-auto-height]').each(function() {
84            var parent = $(this);
85            var items = $('[data-height]', parent);
86            var height = 0;
87            var mode = parent.attr('data-mode');
88            var offset = parseInt(parent.attr('data-offset') ? parent.attr('data-offset') : 0);
89
90            items.each(function() {
91                if ($(this).attr('data-height') == "height") {
92                    $(this).css('height', '');
93                } else {
94                    $(this).css('min-height', '');
95                }
96
97                var height_ = (mode == 'base-height' ? $(this).outerHeight() : $(this).outerHeight(true));
98                if (height_ > height) {
99                    height = height_;
100                }
101            });
102
103            height = height + offset;
104
105            items.each(function() {
106                if ($(this).attr('data-height') == "height") {
107                    $(this).css('height', height);
108                } else {
109                    $(this).css('min-height', height);
110                }
111            });
112
113            if(parent.attr('data-related')) {
114                $(parent.attr('data-related')).css('height', parent.height());
115            }
116       });
117    }
118
119    // Handle Work Popup
120    var handleWorkPopup = function() {
121        var overlay = $('.work-popup-overlay'),
122            close = $('.work-popup-close'),
123            trigger = $('.work-popup-trigger');
124
125        trigger.on('click', function() {
126            $(this).find('.work-popup-overlay').removeClass('work-popup-overlay-show');
127            $(this).find('.work-popup-overlay').addClass('work-popup-overlay-show');
128        });
129
130        close.on('click', function(e) {
131            e.stopPropagation();
132            overlay.removeClass('work-popup-overlay-show');
133        });
134    }
135
136    return {
137        init: function () {
138            // initial setup for fixed header
139            handleHeaderOnScroll();
140            handleOnePageHeader(); // initial header
141            handleCarousel(); // initial setup for carousel
142            handleHeight(); // initial setup for group element height
143            handleWorkPopup(); // initial setup for group work popup
144            
145            // handle minimized header on page scroll
146            $(window).scroll(function() {
147                handleHeaderOnScroll();
148            });
149        },
150
151        // To get the correct viewport width based on  https://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/
152        getViewPort: function() {
153            var e = window,
154                a = 'inner';
155            if (!('innerWidth' in window)) {
156                a = 'client';
157                e = document.documentElement || document.body;
158            }
159
160            return {
161                width: e[a + 'Width'],
162                height: e[a + 'Height']
163            };
164        },
165    };
166}();
167
168$(document).ready(function() {
169    Layout.init();
170});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.