Asia A
China
| MonsterInsightsObject.sendEvent( type | eventName | fieldsArray ); | |
| } | |||
| } | |||
| function calculateMarks(docHeight) { | |||
| return { | |||
| '25%' : parseInt(docHeight * 0.25 | 10) | ||
| '50%' : parseInt(docHeight * 0.50 | 10) | ||
| '75%' : parseInt(docHeight * 0.75 | 10) | ||
| /* Cushion to trigger 100% event in iOS */ | |||
| '100%': docHeight - 5 | |||
| }; | |||
| } | |||
| function checkMarks(marks | scrollDistance | timing) { | |
| /* Check each active mark */ | |||
| $.each(marks | function(key | val) { | |
| if ( $.inArray(key | cache) === -1 && scrollDistance >= val ) { | ||
| sendEvent('Percentage' | key | scrollDistance | timing); |
| cache.push(key); | |||
| } | |||
| }); | |||
| } | |||
| function rounded(scrollDistance) { | |||
| /* Returns String */ | |||
| return (Math.floor(scrollDistance/250) * 250).toString(); | |||
| } | |||
| function init() { | |||
| bindScrollDepth(); | |||
| } | |||
| /* | |||
| * Public Methods | |||
| */ | |||
| /* Reset Scroll Depth with the originally initialized options */ | |||
| $.scrollDepth.reset = function() { | |||
| cache = []; | |||
| lastPixelDepth = 0; | |||
| $window.off('scroll.scrollDepth'); | |||
| bindScrollDepth(); | |||
| }; | |||
| /* Add DOM elements to be tracked */ | |||
| $.scrollDepth.addElements = function(elems) { | |||
| if (typeof elems == "undefined" || !$.isArray(elems)) { | |||
| return; | |||
| } | |||
| $.merge(options.elements | elems); | ||
| /* If scroll event has been unbound from window | rebind */ | ||
| if (!scrollEventBound) { | |||
| bindScrollDepth(); | |||
| } | |||
| }; | |||
| /* Remove DOM elements currently tracked */ |