Releases: francoischalifour/medium-zoom
Releases · francoischalifour/medium-zoom
1.1.0
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
New features
- Methods become chainable. All methods except getters and animation methods (
open()
,close()
andtoggle()
) return the zoom object to allow method calls to be chained.
const zoom = mediumZoom()
zoom
.attach('#image-1', '#image-2')
.on('open', () => zoom.update({ background: 'yellow' }))
.open()
- Animation methods return promises.
open()
,close()
andtoggle()
return promises resolving with the zoom for acting accordingly when the animation is completed. To remain compatible with IE10, promises are converted to no-operation functions if unavailable.
const zoom = mediumZoom('[data-zoom]')
zoom.open().then(() => zoom.update({ background: 'yellow' }))
-
Options
background
supports thebackground
CSS property (not onlybackground-color
)
-
Methods
attach(...selectors: string[]|Element[]|NodeList[]|Array[]) => Zoom
clone(options?: object) => Zoom
getOptions() => object
getImages() => Element[]
getZoomedImage() => Element
-
Events
- "update" is fired when the
update
method is called
- "update" is fired when the
-
Add TypeScript definitions
-
Improve documentation
Bug fixes
- HD image scales the first time on Firefox (264c81f)
- Support
srcset
attribute (#51) - Support SVG sources (#56)
Breaking changes
- Imports. If you're using CommonJS, you'll need to change the require statement:
- const mediumZoom = require('medium-zoom')
+ const mediumZoom = require('medium-zoom').default
-
No images selected by default. Prior to version 1, all scaled images (via HTML or CSS properties) were added to the zoom when calling
mediumZoom()
. Now, callingmediumZoom()
without selector does not attach any images to the zoom. This change is necessary for having a more predictable behavior and a more composable API. -
Options
metaClick
was removed
-
Methods
show() => void
→open({ target?: Element }) => Promise<Zoom>
hide() => void
→close() => Promise<Zoom>
toggle() => void
→toggle({ target?: Element }) => Promise<Zoom>
detach() => void
→detach(...selectors: string[]|Element[]|NodeList[]|Array[]) => Zoom
update(options: object) => void
→update(options: object) => Zoom
addEventListeners(type: string, listener: Function) => void
→on(type: string, listener: Function, options?: object) => Zoom
removeEventListeners(type: string, listener: Function) => void
→off(type: string, listener: Function, options?: object) => Zoom
-
Attributes
data-zoom-target
→data-zoom-src
-
Events
- "show" → "open"
- "shown" → "opened"
- "hide" → "close"
- "hidden" → "closed"