Install
Setup
The plugin needs to be installed onto jQuery. There are two ways to do this:Auto-install (global jQuery)
If jQuery is available onwindow, the plugin installs itself automatically on import:
Manual install (ES modules)
When using a bundler, import and callinstall with your jQuery instance:
Basic Usage
<img> elements into the selected container with visual center alignment and a fade-in transition.
Plugin Options
All shared options are supported, plus these jQuery-specific ones:| Option | Type | Default | Description |
|---|---|---|---|
alignBy | AlignmentMode | "visual-center-y" | How to align logos |
gap | number | string | 28 | Space between logos |
onReady | (logos: NormalizedLogo[]) => void | — | Callback when normalization completes |
onError | (error: Error) => void | — | Callback when all images fail to load |
Methods
Call methods on an existing plugin instance using the standard jQuery plugin convention:process
Update the logos or options on an existing instance:
ready
Returns a native Promise that resolves with the normalized logos when processing completes:
destroy
Removes the plugin instance, cleans up the engine, and empties the container:
instance
Returns the internal plugin instance (engine, unsubscribe function, current options) for the first matched element. Useful for advanced use cases:
Full Example
Dark Mode
PassbackgroundColor for proper contrast detection on opaque logos:
Chaining
The plugin supports standard jQuery chaining for initialization,process, and destroy:
ready method breaks the chain since it returns a Promise instead of a jQuery object.
Re-initialization
Calling.logoSoup({...}) on an element that already has an instance automatically destroys the old instance and creates a new one:
How It Works Under the Hood
The jQuery adapter is a standard$.fn plugin that:
- Stores the engine instance via
$.data()on each element - Subscribes to the engine’s state changes and renders
<img>elements into the container using DOM APIs - Applies
getVisualCenterTransformfor visual center alignment - Uses native
Promisefor thereadymethod (jQuery 4 slim build dropped Deferreds in favor of native Promises) - Cleans up blob URLs and subscriptions on
destroy