Jump to content
Search Community

_lex

Members
  • Posts

    2
  • Joined

  • Last visited

_lex's Achievements

1

Reputation

  1. Perfect, thanks so much for the quick response, answers my question perfectly!
  2. Hi, TL;DR version of my question: What is the performance cost of adding elements that do not exist in the DOM to a timeline? Full version of my question: I'm using Greensock (TweenMax & TimelineMax) on a very dynamic site that uses SmoothState to load pages. Due to the nature of the site, I don't always know which elements will exist on the page. I want to know whether I will pay a huge cost in terms of performance if I create a Timeline with Tweens for let's say 30 elements, but only 5 might exist on the page. This timeline will be re-created on every page load, so I am aware that it is possible to check whether items exist first using something like: if($('.some-element').length) { myTimeline.add(TweenLite.to('.some-element', 3, { autoAlpha: 1 })); } But for code brevity and legibility, I would prefer to just add the Tweens for elements without checking, but only if I'm not going to pay big time in terms of performance (or getting JS errors), seeing as the site is already quite heavy. PS. Absolutely amazing library, well done to the creators! This is my first project of many where I will be using GreenSock extensively. Thank you in advance!
×
×
  • Create New...