Jump to content


TweenLite.selector : * = document.getElementById()

[static] The selector engine (like jQuery, but defaults to document.querySelectorAll()) to use when a tween receives a string as its target, like "#myID".


The selector engine to use when a tween receives a string as its target, like "#myID". By default, GSAP will look for window.$ and then window.jQuery and if neither is found, it will default to document.querySelectorAll(). Typically document.querySelectorAll() is perfectly adequate. So why even bother looking for jQuery? Because it supports slightly more advanced selector options. But again, it's very unlikely that you'll need that. 

Set it like this:

TweenLite.selector = YOUR_SELECTOR_ENGINE;

GSAP does NOT have any dependencies on jQuery or any specific selector engine.

The only requirement for the selector engine is that it must it must make the DOM elements accessible via index notation like selectorResults[0], selectorResults[1], etc. This is pretty standard among selector engines.

Copyright 2017, GreenSock. All rights reserved. This work is subject to theterms of useor for Club GreenSock members, the software agreement that was issued with the membership.