javascript - JS simultaneous execution in Safari -


i have serious problem way safari executing javascript, , renders animations.

in first video snapshot, see execution of animation needed on chrome (same result in firefox), happens expected, sequential lines growing 1 after in right order. http://quick.as/jvv2srykz

the second 1 same animation in safari. http://quick.as/nqlmhdgyd

i can't what's wrong script , why such difference in behaviour between safari , chrome/firefox.

here js written animation on scroll growing lines effect , smoothscroll anchor. feels happening @ same time in safari, if js executed differently in other browsers. idea on issue ? thank you.

/**  * @function datesobjectbuilder  *  * @param collection {htmlcollection}  *  * [1]. adds list elements.  * [2]. adds cards elements.  * [3]. adds dates.  * [4]. adds offests cards elements.  * [5]. calculate offset aside (date list) - header height.  * [6]. calculates list item spacing.  * [7]. adds difference between cards offsets.  */  const datesobjectbuilder = collection => {         collection.each(function (i, e) {             datesobj.ellist.push($(e)); /* [1] */             datesobj.elcards.push($('#year-' + $(e).text())); /* [2] */             datesobj.offsets.push(parseint($('#year-' + $(e).text()).offset().top) - $siteheader.height() - 10); /* [4] */         });          listitemspacing = $(datesobj.ellist[1]).offset().top - $(datesobj.ellist[0]).offset().top; /* [6] */         eloffset = datesobj.elcards[0].offset().top - $(siteheader).height() - 30; /* [5] */          (let = 0, offsetslength = datesobj.offsets.length - 1; < offsetslength; i++) {             datesobj.diffs.push(parseint((datesobj.offsets[i + 1] - datesobj.offsets[i]) / 100)); /* [7] */         }     };  /**  * @function handlecardsscroll  *  * [1]. loop through each card  * [2]. each card element check if scroll  *      position higher offset of card  * [3]. calculate percentage of period based on scroll  * [4]. set maximum percentage (1) , round value  * [5]. apply percentage on black line  * [6]. if period not yet visible, hide black line  * [7]. check if period active if scroll higher card's offset , lower next card  * [8]. if reach end of viewport, set last card active  * @param scroll {int} scroll position  */    const handlecardsscroll = scroll => {          (let = 0, tablength = datesobj.elcards.length; < tablength; i++) { /* [1] */             if (scroll >= datesobj.offsets[i]){ /* [2] */                 percent = (scroll - datesobj.offsets[i]) / datesobj.diffs[i]; /* [3] */                 percent = math.min(1, math.floor(percent) * 0.01); /* [4] */                 $(datesobj.ellines[i]).css('transform', 'scale(1, ' + percent + ')'); /* [5] */             } else {                 $(datesobj.ellines[i]).css('transform', 'scale(1, 0)');  /* [6] */             }              if (scroll >= datesobj.offsets[i] && scroll < datesobj.offsets[i + 1]) {  /* [7] */                 $(datesobj.ellist[i]).addclass(isactiveclass);                 $(datesobj.ellines[i]).addclass(isactiveclass);             } else {                 $(datesobj.ellist[i]).removeclass(isactiveclass);                 $(datesobj.ellines[i]).removeclass(isactiveclass);             }         }          if(viewportheight + scroll >= viewportcontentheight) { /* [8] */             $(datesobj.ellist[datesobj.elcards.length-1]).addclass(isactiveclass);             $(datesobj.ellist[datesobj.elcards.length-2]).removeclass(isactiveclass);         }     };   /**  * @function handlesmoothscroll  *  * function called when user clicks on date in sidebar  * scroll smoothly ancre.  *  * [1]. adds viewport scroll position ancre offset top, minus navbar height.  */ const handlesmoothscroll = () => {     $(document).on('click', datelistlinkclass, function () {         let speed = 650;         let ancre = $(this).attr('href');         let origin = $(viewport).scrolltop();         let eloffsettop = $(ancre).offset().top;          $(viewport).animate({             scrolltop: (origin + eloffsettop) - $siteheader.height() /* [1] */         }, speed);     }); }; 


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -