';
$('body').append($markup);
$('#modal-search').find('.header-search').prepend('
Search Hershey & Harrisburg ');
$('#modal-search').find('.searchBox').attr('placeholder','What are you searching for?');
$('#modal-search').find('input.submit').attr('value', 'Search');
},
action : function() {
if ($('html').hasClass('touch')) {
$event = 'touchstart';
} else {
$event = 'click';
}
$('body').on($event, '.search_box', function() {
$('#modal-search').addClass('active');
$('body').addClass('noscroll');
});
$('body').on($event, '.modal-close', function() {
$('#modal-search').removeClass('active');
$('body').removeClass('noscroll');
});
},
init : function() {
$search_modal.markup();
$search_modal.action();
}
}
$mobile_nav = {
markup : function() {
$top_nav = $('.top_nav > div').clone(true, true);
$main_nav = $('.main_nav nav.main').clone(true, true);
$markup = '
';
$markup += '
';
$markup += '
';
$markup += $main_nav.html();
$markup += $top_nav.html();
$markup += '
';
$markup += '
';
$('body').append($markup);
$('.mobile-nav-wrap .navItem').each(function() {
if ($(this).find('.navDropdown').length) {
$(this).append('
');
$parentLink = $(this).find('> a:first-child').text();
$childLinks = $(this).find('.navDropdown .row .medium-8').clone(true, true);
$markup_subpages = '
';
$markup_subpages += '
';
$markup_subpages += $childLinks.html();
$markup_subpages += '
';
$('#mobile-nav').append($markup_subpages);
}
});
},
action : function() {
if ($('html').hasClass('touch')) {
$event = 'touchstart';
} else {
$event = 'click';
}
$('.mobile-btn, .mobile-bg').on($event, function() {
if ($(this).hasClass('mobile-btn')) {
$(this).toggleClass('active');
} else {
$('.mobile-btn').removeClass('active');
}
$('#mobile-nav').toggleClass('active');
$('body').toggleClass('noscroll');
$('.flyin').removeClass('active');
});
$('body').on($event,'.child-pages.arrow', function() {
$subpages = $(this).siblings('a').text();
$('.flyin').removeClass('active');
$('.flyin[data-id="'+$subpages+'"]').addClass('active');
});
$('body').on($event, '.child-pages.back', function() {
$('.flyin').removeClass('active');
});
},
init : function() {
$mobile_nav.markup();
$mobile_nav.action();
}
}
$slick = {
init : function() {
$('.hero-slider__slider').slick( {
dots: false,
arrows: false,
infinite: true,
autoplay: true,
autoplaySpeed: 5000,
fade: true,
cssEase: 'linear',
pauseOnHover: false,
});
}
}
$booking = {
action : function() {
$URL = $('.bookingOptions li a').attr('href');
$content = function() {
$('.bookingTitle h2').text('Book Your Stay');
$('.bookingTitle').prepend('
Book Your Stay ');
// $clone = $('#aresWidget > #aresContent #aresWrap').clone();
$('#hotelSearchForm .bookingButton').append('
Book Now See All Hotels #aresWrap').addClass('animateIn');
}
setTimeout($content, 2000);
$('body').on('click', '.bookingTitle .hide-show-title', function() {
$(this).toggleClass('active');
$(this).parents('#aresWrap').toggleClass('active');
});
},
init : function() {
$booking.action();
}
}
$grid = {
action : function() {
$('.grid.std').each(function() {
$count = $(this).find('.block').length;
$(this).attr('data-count', $count);
$block = $(this).find('> .wrapper > .block');
$row = $(this).find('> .wrapper .block-wrap').length;
$that = $(this);
for (var i = 0, l = $block.length; i < l; i +=4) {
$row++;
if ($row % 2 == 0) {
$direction = 'reverse';
} else {
$direction = '';
}
$block.slice(i, i+4).wrapAll('
');
}
$('.block-wrap').each(function() {
$count = $(this).find('.block').length;
$(this).attr('data-count', $count);
});
});
$('.grid.full').each(function() {
$count = $(this).find('.block').length;
$(this).attr('data-count', $count);
});
},
init : function() {
$grid.action();
}
}
$tabs = {
action : function() {
$('.tabs-content .content li span+span img').each(function() {
$remove_that_colon = $(this).parents('li').find('span:first-child').text();
$remove_that_colon = $remove_that_colon.slice(0,-1);
// console.log($remove_that_colon);
$(this).parents('li').find('span:first-child').text($remove_that_colon);
});
},
init : function() {
$tabs.action();
}
}
$touchPress = {
action: function() {
if($('html.touch').length) {
$(document).on('click touchstart', function(e) {
$top = e.pageY;
$left = e.pageX;
$('.touchPress').remove();
$('body').append('
');
setTimeout(function() {
$('.touchPress').remove();
}, 500);
});
}
},
init : function() {
$touchPress.action();
}
}
$select_field = {
action: function() {
$('.select-wrap').each(function() {
$current_value = $(this).next('.tabs').find('.active').text();
$(this).find('.select-option').text($current_value);
});
$('.tabSelector').on('change', function() {
$new_value = $(this).val();
$new_value_text = $(this).find('option[value="'+$new_value+'"]').text();
$(this).parent('.select-wrap').find('.select-option').text($new_value_text);
$('.tabPane > .tabs-content > .content').removeClass('active');
$('.tabPane > .tabs-content '+$new_value).addClass('active');
});
},
init: function() {
$select_field.action();
}
}
$external_link = {
action: function() {
$('[href="https://www.explorehbg.com/"]').attr('target', '_blank');
},
init: function() {
$external_link.action();
}
}
$forms = {
action: function() {
// $('#sortBy').wrap('
');
// $init_val = $('#sortBy :selected').text();
// $('.select-wrap').prepend('
'+$init_val+' ');
// $('#sortBy').on('change', function() {
// $val = $(this).find(':selected').text();
// $(this).parents('.select-wrap').find('.select-label').text($val);
// });
$('body').on('change','#fieldjhjjwh', function() {
$val = $(this).find('option:selected').text();
console.log($val);
if($val !== 'United States of America') {
$('#fieldjhjjwd').parent('p').addClass('hidden');
} else {
$('#fieldjhjjwd').parent('p').removeClass('hidden');
}
});
},
init: function() {
$forms.action();
}
}
$addBodyClasses = {
action: function() {
if($('.hy-results').length) {
$('body').addClass('listings');
}
if($('.contentRender_name_plugins_search_results').length) {
$('body').addClass('search-results');
}
if($('.slideshow_container > *').length) {
$('body').addClass('hero-slider');
}
},
init: function() {
$addBodyClasses.action();
}
}
$addPrint = {
action: function() {
$('body.listings').find('.hy-listings__content-header .hy-listings__content-pagination').append('
Print ');
},
init: function() {
$addPrint.action();
}
}
$forms = {
action: function() {
$('body').on('change','#fieldjhjitku', function() {
$choice = $(this).val();
$choice = $('option[value="'+$choice+'"]').text();
if ($choice === 'Yes') {
console.log($choice);
// $('label[for="listydtuyuy"]').trigger('click').addClass('checked');
$('#listydtuyuy').prop('checked', true).addClass('checked');
} else {
$('#listydtuyuy').prop('checked', false).removeClass('checked');
}
});
},
init: function() {
$forms.action();
}
}
$mobile_nav.init();
$search_modal.init();
$slick.init();
$booking.init();
$grid.init();
$tabs.init();
$touchPress.init();
$select_field.init();
$external_link.init();
$forms.init();
$addBodyClasses.init();
$addPrint.init();
$forms.init();
});
$(window).on("load resize",function(e){
// if ($(window).width() <= 1024 && $('aside.hy-listings__filters').length) {
// if (!$('aside .hy-header-toggle').hasClass('is-collapsed')) {
// $('aside .hy-header-toggle').trigger('click');
// }
// $('.toggleAll').trigger('click');
// }
$equalHeight = {
action: function() {
if ($('.tab-blocks')) {
if ($(window).width() > 768) {
$('.tab-blocks').each(function(e) {
$tallest = 0;
$that = $(this);
$that.find('h3').each(function() {
$height = $(this).height();
$text = $(this).text();
if ($height >= $tallest) {
$tallest = $height;
}
});
$that.find('h3').height($tallest);
});
} else {
$('.tab-blocks').find('h3').height('auto');
}
}
},
init: function() {
$equalHeight.action();
}
}
$equalHeight.init();
});
});