!function(){function l(e,t){return t?this.settings.readingEventLabelPrefix+e+" pixels":e<.001?this.settings.readingEventLabelPrefix+"0%":this.settings.readingEventLabelPrefix+100*e+"%"}function d(e,t,i,n){if(!this.DEBUG_MODE){var s=function(){var e=null;null!=this.settings.gtmDataLayerName?e=this.settings.gtmDataLayerName:"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(e=dataLayer);return e}();null==this.GA_TYPE&&(this.GA_TYPE=function(){var t=document.getElementsByTagName("script"),e="";for(var i in t)try{var n=t[i].getAttribute("src");if(n){if(-1!=n.indexOf("/gtm.js")){e="gtm";break}-1!=n.indexOf("/gtag")?e="gtag":-1!=n.indexOf("/analytics.js")?e="ga":-1!=n.indexOf("/ga.js")&&(e="gaq")}}catch(e){this.DEBUG_MODE&&(console.log(t[i]),console.log(e))}return e}()),"gtm"==this.GA_TYPE&&null!=s?(console.log("SOURCE: GTM"),s.push({event:this.settings.gtmEventName,eventCategory:e,eventAction:t,eventLabel:i,eventValue:n})):"gtag"==this.GA_TYPE?(console.log("SOURCE: GTAG"),gtag("event","mm_page_track",{event_category:e,event_action:t,event_label:i,event_value:n})):"ga"==this.GA_TYPE?(console.log("SOURCE: GA"),ga("send",{hitType:"event",eventCategory:e,eventAction:t,eventLabel:i,eventValue:n})):"gaq"==this.GA_TYPE&&(console.log("SOURCE: GAQ"),"undefined"!=typeof pageTracker?pageTracker._trackEvent(e,t,i,n):(_gaq.push(["_trackEvent",e,t,i,n]),_gaq.push(["pageTracker._trackEvent",e,t,i,n])))}}function t(){for(i=0;i=this.readerLocations[i]&&0=e+c)){var l=0==h.adjustX?h.bgXPosition:Math.round((f-e)*h.adjustX)+0+h.bgXOffset+"px",m=0==h.adjustY?h.bgYPosition:Math.round((f-e)*h.adjustY)+0+h.bgYOffset+"px";b.css("background-position",l+" "+m)}})})},a.fn.parallaxLockElement=function(b){var c=!1,d=a.extend({parentEl:"",offsetTop:0,additionalCSS:void 0,onLock:void 0,onRelease:void 0},b);return this.each(function(){var b=a(this),e=a(d.parentEl);a(window).scroll(function(){var f=parseInt(e.offset().top-a(window).scrollTop()-d.offsetTop),g=e.offset().top+e.outerHeight(),i=(parseInt(b.outerHeight()),e.offset().top+e.outerHeight()-(b.offset().top+b.outerHeight()));f<=0?g+i<=a(window).scrollTop()+a(window).innerHeight()?c&&(c=!1,b.css({position:"absolute",top:"inherit",bottom:i+"px"}),"function"==typeof d.onRelease&&d.onRelease(this)):(b.css({position:"fixed",top:d.offsetTop+"px",bottom:"auto"}),"function"==typeof d.onLock&&d.onLock(this),c=!0):(b.css({position:"relative",top:"auto"}),"function"==typeof d.onRelease&&d.onRelease(this),c=!1),void 0!=d.additionalCSS&&b.css(d.additionalCSS)})})},a.fn.parallaxAnimateElement=function(b){var c=new Array,d=0,e=0,f=!1,g=a.extend({frames:1,elementClass:"floatingElement",elementFrameClassRoot:"frame",startOffset:null,endOffset:null,showWhenCentered:!1,centerOffsetAnimationRange:null,lock:!1,parentEl:"",offsetTop:0,additionalCSS:void 0,onLock:void 0,onRelease:void 0},b);g.lock?a(this).parallaxLockElement({parentEl:g.parentEl,offsetTop:g.offsetTop,additionalCSS:g.additionalCSS,onLock:g.onLock,onRelease:g.onRelease}):f=!0;var h=parseInt(a(this).parent().height());if(g.showWhenCentered)null==g.centerOffsetAnimationRange?g.centerOffsetAnimationRange=1:g.centerOffsetAnimationRange.indexOf("%")!=-1?g.centerOffsetAnimationRange=parseInt(g.centerOffsetAnimationRange)/100:g.centerOffsetAnimationRange=1;else{if(null!=g.startOffset)if(g.startOffset.indexOf("%")!=-1){var i=parseInt(g.startOffset)/100;d=Math.floor(h*i)}else{var i=parseInt(g.startOffset);d=i}if(null!=g.endOffset)if(g.endOffset.indexOf("%")!=-1){var i=parseInt(g.endOffset)/100;e=Math.floor(h-h*i)}else{var i=parseInt(g.endOffset);e=i}0==d&&0==e||(h=h-e-d);for(var j=h/g.frames,k=1;k<=g.frames;k++)c.push(Math.floor(d+j*k));f&&void 0!=g.additionalCSS&&a(this).css(g.additionalCSS)}return this.each(function(){var b=a(this),d=c.length,e=g.showWhenCentered?a(this).height()*g.centerOffsetAnimationRange:a(this).height();a(window).scroll(function(){var f=b.offset().top,h=!(f+b.outerHeight()<=a(window).scrollTop()||f>=a(window).scrollTop()+a(window).height());if(h){if(g.showWhenCentered){var i=parseInt(b.offset().top-a(window).scrollTop()),j=parseInt(i+e/2),k=parseInt(a(window).innerHeight()/2),l=parseInt(j-e),m=parseInt(j+e);if(k=l&&k<=m){var n=Math.max(0,Math.min(1,1-(l+(j-k))/j));d=Math.ceil(g.frames*n)}else d=g.frames}else for(var o=parseInt(b.parent().offset().top-a(window).scrollTop()),p=o*-1+e/2,q=0;q=$(window).scrollTop()+$(window).height())},getItemInViewportCenter=function(a,b){var c=$(a).offset().top,d=$(window).height()/2;return b=b||0,!(c>=$(window).scrollTop()+d+b||c<=$(window).scrollTop()+d-b)},getStickyTopBarHeight=function(){return _stickyTopBarHeight},getIsMobile=function(){return _isMobile},getIsTablet=function(){return _isTablet},getDoParallax=function(){return _doParallax},getIsDesktop=function(){return!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},getIsIPad=function(){return navigator.userAgent.match(/iPad;.*CPU.*OS/i)},getIsIPad=function(){return navigator.userAgent.match(/iPad;.*CPU.*OS/i)},getIsNewerIpad=function(){return!!getIsIPad()&&1!=window.devicePixelRatio},getIsResponsive=function(){return IS_RESPONSIVE},adjustLayoutAfterResize=function(){initChapterTops(!0),adjustMultiSizedImages()},adjustChapterLinksArtHeight=function(a,b){$(a).css("height",$(b).outerHeight())},adjustSizeToParentAndViewport=function(a,b){$(a).css("height",getVisibleViewport(!0)),$(a).css("width",$(b).width())},adjustSizeHeightToParent=function(a,b){var c=$(b).height();$(a).css("height",c+"px")},equalizeElementHeightsToTallest=function(a){for(var b=0,c=0;cb?d:b)}for(var c=0;c=0;f--)if($(document).scrollTop()>=_chapterTops[f]){a=f+1;break}return a!=-1&&adjustChapterLinks(a),a}},adjustChapterLinks=function(a){$(_chapterLinkEl).each(function(){$(this).attr("href")!="#"+a?"function"==typeof _setChapterLinkCallback&&_setChapterLinkCallback(this,!1):("function"==typeof _setChapterLinkCallback&&_setChapterLinkCallback(this,!0),_onChapter=a)})},adjustMultiSizedImages=function(){var a=$(_multiSizeImageEl);a.length&&a.each(function(){getIsResponsive()||void 0==$(this).data("src-legacy")?getIsMobile()&&void 0!=$(this).data("src-small")?$(this).attr("src",$(this).data("src-small")):getIsTablet()&&void 0!=$(this).data("src-medium")?$(this).attr("src",$(this).data("src-medium")):void 0!=$(this).data("src")&&$(this).attr("src",$(this).data("src")):$(this).attr("src",$(this).data("src-legacy"))})},toTop=function(){$("html, body").animate({scrollTop:0},600)},runTopMenuControl=function(){getIsMobile()?toggleMobileMenu(_mobileMenuEl,_topAndMobileMenuControl):toTop()},toggleMobileMenu=function(a,b){getIsMobile()&&($(a).toggle("fast"),$(b).toggle("fast"))},goToChapter=function(a){var b=$(_chapterElPrefix+a),c=b.offset().top-_stickyTopBarHeight+1,d=_onChapter>a?_onChapter-a:a-_onChapter,e=Math.floor(1e3/(_chapterTops.length-(_chapterTops.length-d)));$("html, body").animate({scrollTop:c},e,function(){adjustChapterLinks(a),"function"==typeof _chapterSetCompleteCallback&&_chapterSetCompleteCallback(a)}),_onChapter=a},animateOverflowContent=function(a,b,c,d,e){if(e==_onChapter){var f=$(a).css("background-position").split(" "),g=isNaN(b)?b:b+parseInt(f[0])+"px",h=isNaN(c)?c:c+parseInt(f[1])+"px";$(a).css({"background-position":g+" "+h})}window.setTimeout(function(){animateOverflowContent(a,b,c,d,e)},d)},cycleImages=function(a,b){var c=$(a+" .active"),d=c.next().length>0?c.next():$(a+" img:first");d.css("z-index",2),c.fadeOut(b,function(){c.css("z-index",1).show().removeClass("active"),d.css("z-index",3).addClass("active")})}; /** * v1.0 - Copyright 2016 Madden Media - All rights reserved. * * Content-specific layout functionality. These functions * make many assumptions about content contained in the page. * * NOTE: Assumes that madden-content-frameworks-v1.0.js has been loaded and * that the initial view types (mobile, tablet, etc.) have been defined. */ // mobile can call resize during scroll - we can cache width // and check if an actual resize happens var _winWidth = 0; ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // STOCK EVENT FUNCTIONS ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// $(document).ready(function () { adjustHero(); }); adjustHero = function () { var tbH = $("#topBar").outerHeight(); var tH = $("#heroTitle").outerHeight(); var tW = $("#heroTitle").outerWidth(); var ww = $(window).innerWidth(); var wh = $(window).innerHeight(); var nh = (wh - tbH); var padding = 80; // parent hero $("#ci0").css({ "margin-top": tbH, "height": nh }); // all borders $(".heroBorder").css({ "width": (ww - padding), "height": (wh - tbH - padding) }); // specific left and bottom border adjustments $("#heroBorderL").css({ "height": (wh - tbH - padding - tH) }); $("#heroBorderB").css({ "width": (ww - padding - tW) }); } // // Called on document ready // contentOnReady = function () { // set the window width _winWidth = $(window).width(); // parallax effects if (getDoParallax()) { // parallax bgs $("#ci2").parallaxBG({ adjustY: .12, bgXPosition: 'center' }); $("#ci3").parallaxBG({ adjustY: .12, bgXPosition: 'center' }); $("#ci4").parallaxBG({ adjustY: .12, bgXPosition: 'center' }); $("#fe1").parallaxAnimateElement({ frames: 8, startOffset: "-80%", endOffset: "120%", lock: false, parentEl: "#c1", elementClass: "floatingElement w4Col floatRight" }); $("#mp1").parallaxAnimateElement({ frames: 8, startOffset: "-40%", endOffset: "120%", lock: false, parentEl: "#c1", elementClass: "floatingElement mapPoint w4Col floatRight" }); $("#fe2").parallaxAnimateElement({ frames: 8, startOffset: "-80%", endOffset: "120%", lock: false, parentEl: "#c2", elementClass: "floatingElement w4Col floatRight" }); $("#fe3").parallaxAnimateElement({ frames: 8, startOffset: "-80%", endOffset: "120%", lock: false, parentEl: "#c3", elementClass: "floatingElement w4Col floatRight" }); $("#fe4").parallaxAnimateElement({ frames: 8, startOffset: "-80%", endOffset: "180%", lock: false, parentEl: "#c4", elementClass: "floatingElement w4Col floatRight" }); $("#fe5").parallaxAnimateElement({ frames: 8, startOffset: "-40%", endOffset: "180%", lock: false, parentEl: "#c4", elementClass: "floatingElement last w4Col floatRight" }); } // Recommended Reads links var RELATED = {}; RELATED["1"] = { "id" : "1", "link": "http://www.visitcurrituck.com/rentals-and-lodging/vacation-rentals/", "title": "Vacation Rentals", "border": "" }; RELATED["2"] = { "id" : "2", "link": "http://www.visitcurrituck.com/things-to-do/beaches/", "title": "Beaches", "border": "" }; RELATED["3"] = { "id" : "3", "link": "http://www.visitcurrituck.com/things-to-do/activities/", "title": "Currituck Activities", "border": "" }; RELATED["4"] = { "id" : "4", "link": "http://www.visitcurrituck.com/things-to-do/kids-zone/", "title": "Kids Zone", "border": "" }; // Populate the links on the Hub var links = document.getElementById('alsoLikeLinkWrap'); // find the div to build in var i = 0; for (var i in RELATED) { if (!document.getElementById('links'+i)) { // build the links var newLink = document.createElement("div"); newLink.setAttribute("id","links" + RELATED[i].id); newLink.setAttribute("class","linkWrapper"); newLink.innerHTML = "" + "" links.appendChild(newLink); } i++; } // End Recommended Reads links customAdjustLayout(true); // add the complete class to the loader $('#loading').addClass('complete'); } // // Called on document scroll // contentOnScroll = function () { } // // Called on a touch move on mobile // contentOnTouchMove = function () { } // // Called on document resize // contentOnResize = function () { customAdjustLayout(); } ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // CUSTOM FUNCTIONS ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // // The frameworks was given this function to handle setting chapter buttons // when the chapter is set // // chapterEl: The chapter link DOM element // on: Is it being turned on? (true|false) // customChapterLinkAdjust = function (chapterEl, on) { $(chapterEl).attr("class", ((on) ? "navLink chapterLink noGA on" : "navLink chapterLink noGA")); } // // Adjust this specific layout after a load or resize event // // isLoad: Is this being called by a load or resize event? // customAdjustLayout = function (isLoad) { adjustHero(); var localNotJustTouchScroll = isLoad; // is it really a resize? if ($(window).width() != _winWidth) { // yes localNotJustTouchScroll = true; _winWidth = $(window).width(); } if (localNotJustTouchScroll) { } }