PageSourceSearch

https://www.gokleen.com.my/js/custom-isotope-portfolio.js

js gokleen.com.my collected 2026-10-06 19:08:08 UTC 8,751 bytes, 236 lines download raw bytes

1jQuery(document).ready(function () {
2    // Isotope for Portfolio
3
4    jQuery('.patti-grid[id^="gridwrapper_"]').each(function () {
5
6        var $div = jQuery(this);
7        var token = $div.data('token');
8        var settingObj = window['dt_grid_' + token];
9
10        var $container = '';
11        var $optionSets = '';
12
13        $initial_filter = '';
14
15        if (typeof settingObj === 'undefined') {
16            $container = jQuery(" .grid_portfolio");
17            $optionSets = jQuery('#gridwrapper_portfolio #options .option-set');
18        }
19        else {
20            if (settingObj.initial_word != '') {
21                $initial_filter = '.' + settingObj.initial_word + '';
22            }
23            $container = jQuery(".grid_" + settingObj.id + "");
24            $optionSets = jQuery('#gridwrapper_' + settingObj.id + '  #options .option-set');
25        }
26
27        colWidth = function () {
28            var w = $container.width(),
29                columnNum = 1,
30                columnWidth = 0;
31
32            // apply default settings
33            if (vals.grid_manager != 1) {
34                if (w > 1440) {
35                    columnNum = 7;
36                } else if (w > 1365) {
37                    columnNum = 5;
38                } else if (w > 1279) {
39                    columnNum = 5;
40                } else if (w > 1023) {
41                    columnNum = 5;
42                } else if (w > 767) {
43                    columnNum = 5;
44                } else if (w > 479) {
45                    columnNum = 3;
46                }
47            }
48
49                // apply custom settings
50            else {
51                if (w > 1440) {
52                    columnNum = vals.grid_very_wide;
53                } else if (w > 1365) {
54                    columnNum = vals.grid_wide;
55                } else if (w > 1279) {
56                    columnNum = vals.grid_normal;
57                } else if (w > 1023) {
58                    columnNum = vals.grid_small;
59                } else if (w > 767) {
60                    columnNum = vals.grid_tablet;
61                } else if (w > 479) {
62                    columnNum = vals.grid_phone;
63                }
64            }
65
66
67            columnWidth = Math.floor(w / columnNum);
68
69            $container.find('.grid-item').each(function () {
70                var $item = jQuery(this);
71
72                var gwidth = 4;
73                if (vals.grid_manager == 1) {
74                    gwidth = vals.grid_gutter_width
75                }
76
77                $item.css({ 'margin': gwidth / 2 });
78
79                if ($item.hasClass('item-wide')) {
80                    if (w < 480) {
81                        jQuery('.item-wide').css({
82                            'width': ((columnWidth) - gwidth) + 'px',
83                            'height': Math.round(((columnWidth) - gwidth) * 0.7777777) + 'px'
84                        });
85                        jQuery('.item-wide img').css({
86                            //'width': ((columnWidth) - gwidth) + 'px',
87                            //'height': 'auto'
88                        });
89                    }
90                    else {
91                        jQuery('.item-wide').css({
92                            'width': ((columnWidth * 2) - gwidth) + 'px',
93                            'height': Math.round((2 * (((columnWidth) - gwidth) * 0.7777777)) + gwidth) + 'px'
94                        });
95                        jQuery('.item-wide img').css({
96                            //'width': ((columnWidth * 2) - gwidth) + 'px',
97                            //'height': 'auto'
98                        });
99                    }
100                }
101
102                if ($item.hasClass('item-small')) {
103                    jQuery('.item-small').css({
104                        'width': ((columnWidth) - gwidth) + 'px',
105                        'height': Math.round(((columnWidth) - gwidth) * 0.7777777) + 'px'
106                    });
107                    jQuery('.item-small img').css({
108                        //'width': ((columnWidth) - gwidth) + 'px',
109                        //'height': 'auto'
110                    });
111                }
112
113                if ($item.hasClass('item-long')) {
114                    if (w < 480) {
115                        jQuery('.item-long').css({
116                            'width': ((columnWidth) - gwidth) + 'px',
117                            'height': Math.round(((columnWidth) - gwidth) * 0.7777777 / 2) + 'px'
118                        });
119                        jQuery('.item-long img').css({
120                            //'width': ((columnWidth) - gwidth) + 'px',
121                            //'height': 'auto'
122                        });
123                    }
124                    else {
125                        jQuery('.item-long').css({
126                            'width': ((columnWidth * 2) - gwidth) + 'px',
127                            'height': Math.round(((columnWidth) - gwidth) * 0.7777777) + 'px'
128                        });
129                        jQuery('.item-long img').css({
130                            //'width': ((columnWidth * 2) - gwidth) + 'px',
131                            //'height': 'auto'
132                        });
133                    }
134                }
135
136                if ($item.hasClass('item-high')) {
137                    jQuery('.item-high').css({
138                        'width': ((columnWidth) - gwidth) + 'px',
139                        'height': Math.round((2 * (((columnWidth) - gwidth) * 0.7777777)) + gwidth) + 'px'
140                    });
141                    jQuery('.item-high img').css({
142                        //'width': ((columnWidth) - gwidth) + 'px',
143                        //'height': 'auto'
144                    });
145                }
146
147            });
148            return columnWidth;
149        }
150
151        $container.find('.grid-item-on-hover').each(function () {
152            var $item = jQuery(this);
153
154            $item.mouseover(function () {
155                $item.css("opacity", "0.9");
156            });
157
158            $item.mouseout(function () {
159                $item.css("opacity", "0");
160            });
161        });
162
163        // Isotope Call
164        gridIsotope = function () {
165            $container.isotope({
166                columnWidth: 184,
167                layoutMode: 'masonry',
168                itemSelector: '.grid-item',
169                animationEngine: 'jquery',
170                filter: $initial_filter,
171                masonry: { columnWidth: colWidth(), gutterWidth: 0 }
172            });
173        };
174
175        resizedIsotope = function () {
176            $container.isotope({
177                columnWidth: 184,
178                layoutMode: 'masonry',
179                itemSelector: '.grid-item',
180                animationEngine: 'jquery',
181                masonry: { columnWidth: colWidth(), gutterWidth: 0 }
182            });
183        };
184
185        gridIsotope();
186        jQuery(window).smartresize(resizedIsotope);
187        jQuery(window).on("load", gridIsotope);
188
189
190        // Portfolio Filtering
191
192        $optionLinks = $optionSets.find('a');
193
194        if ($initial_filter != '') {
195            $optionLinks.each(function () {
196                var $this = jQuery(this);
197                if ($this.hasClass('selected')) {
198                    $this.removeClass('selected');
199                }
200                if ($this.attr('data-option-value') == $initial_filter) {
201                    $this.addClass('selected');
202                }
203            });
204        }
205
206        $optionLinks.click(function () {
207            var $this = jQuery(this);
208            // don't proceed if already selected
209            if ($this.hasClass('selected')) {
210                return false;
211            }
212            var $optionSet = $this.parents('.option-set');
213            $optionSet.find('.selected').removeClass('selected');
214            $this.addClass('selected');
215
216            // make option object dynamically, i.e. { filter: '.my-filter-class' }
217            var options = {},
218                key = $optionSet.attr('data-option-key'),
219                value = $this.attr('data-option-value');
220            // parse 'false' as false boolean
221            value = value === 'false' ? false : value;
222            options[key] = value;
223            if (key === 'layoutMode' && typeof changeLayoutMode === 'function') {
224                // changes in layout modes need extra logic
225                changeLayoutMode($this, options)
226            } else {
227                // otherwise, apply new options
228                $container.isotope(options);
229            }
230
231            return false;
232        });
233
234
235    });
vendor: 3 bytes, line 236
236});

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.