StringTune/Docs

Concepts

Configuration

Global settings, runtime properties, common attributes, and what is actually part of the public API.

Configuration

Global setup

Use setupSettings() for runtime-wide defaults:

TypeScript
stringTune.setupSettings({
  'offset-top': '-10%',
  'offset-bottom': '-10%',
  'cursor-lerp': 0.75,
  timeout: 900,
});

Supported helpers

scrollTo(...)

Supported public API:

TypeScript
stringTune.scrollTo(640);
stringTune.scrollTo('#pricing');
stringTune.scrollTo(pricingElement);

stringTune.scrollTo({ position: 640 });
stringTune.scrollTo({ position: 640, immediate: true });
stringTune.scrollTo({ position: 640, offset: -80 });

stringTune.scrollTo({ selector: '#pricing', offset: -80 });
stringTune.scrollTo({ element: pricingElement, immediate: true });

scrollTo accepts a numeric position, a CSS selector, an HTMLElement, or an object with position, selector, or element.

immediate defaults to false. offset is added to the resolved position and is supported on object forms only. If a selector or element cannot be resolved, the call exits without throwing.

invalidateCenter(id)

Invalidates the cached center for a specific object by its id. Use this after a programmatic DOM change that shifts one element's position.

TypeScript
stringTune.invalidateCenter('my-element-id');

Note: The older invalidateCenters() method (no argument, invalidating all at once) was removed in v1.1.51. If you need to recompute layout for all elements after a bulk DOM change, use onResize(true) instead — it rebuilds the full runtime state including all cached positions.

onResize(force?)

Forces a full layout rebuild. Pass true to bypass the internal change-detection checks and guarantee a complete recomputation.

TypeScript
stringTune.onResize(true);

Use this after bulk DOM mutations (content injected, elements rearranged) where simply scrolling or resizing the window would not naturally trigger a rebuild.

Not supported as public API

The following helpers should not appear in the docs as official API because they are not part of the current public surface:

  • scrollToElement()
  • invalidateCenters()

scrollPosition

scrollPosition is an immediate setter. It updates runtime scroll state directly and should not be described as a built-in animated transition helper.

Common attributes

Shared attributes include:

  • string
  • string-id
  • string-copy-from

Notes on legacy or misleading attributes

  • self-disable should be described narrowly as suppressing style writes on the primary element, not as a full module shutdown.
  • fixed should not be documented as a generic lock-in-place behavior.
  • abs should not be described as a guaranteed supported integration feature without confirmed runtime effect.