Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // fix popup for mobile tablet
- ajq('#evergage-tooltip-amb${message.id}').css("position", "absolute");
- var timeLimitSec = 6;
- var expand = false;
- var bottomCounter = 0;
- var start;
- //function checks if the div has expanded
- function checkExpand(){
- if (ajq("#orderAreaWrap").css("display") != "none"){
- console.log('Product Wrap is expanded');
- expand = true;
- clearInterval(listener);
- start = performance.now();
- //only listen after seconds, that way the page is fully loaded
- setTimeout(function(){
- console.log('start listening')
- scroller();
- } , 3000);
- }
- }
- //listens ever 20 ms to see if the page has expanded.
- var listener = setInterval(function(){
- console.log('checking expanded');
- checkExpand();}, 20);
- //scroll listener
- function scroller(){
- ajq(window).scroll(function(event){
- var position = ajq(window).scrollTop();
- var height = ajq(document).height();
- var windowHeight = ajq(window).height();
- var diff = height -windowHeight;
- var diffTime = performance.now() - start;
- //only fire off message if it gets to the bottom under the specified timeLimit and only fire off ONCE.
- if (diff == position && expand===true && diffTime/1000<timeLimitSec && bottomCounter === 0){
- console.log('Loaded');
- _aaq.push(['trackAction', 'fireFastScroll']);
- bottomCounter = bottomCounter + 1;
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement