GA for zoom
This commit is contained in:
parent
81aaf64738
commit
9220aafacf
src
|
@ -104,9 +104,8 @@ const PartMore = () => {
|
|||
|
||||
const Gallery = ({ contents }) => {
|
||||
const zoom = mediumZoom();
|
||||
zoom.on('open', event => {handleZoom(event.target.src)})
|
||||
|
||||
const zoomRef = React.useRef(zoom);
|
||||
|
||||
return (
|
||||
contents.map((url, index) => (
|
||||
<LazyLoad key={'lazy_gallery_' + index} offsetVertical={200}>
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
import React from 'react';
|
||||
import {handleZoom} from "../../utils/gaHelper";
|
||||
|
||||
const ImageZoom = ({ zoom, ...other }) => {
|
||||
const zoomRef = React.useRef(zoom.clone(other));
|
||||
zoomRef.current.on('open', event => {handleZoom(event.target.src)})
|
||||
|
||||
const ImageZoom = (props) => {
|
||||
const zoomRef = React.useRef(props.zoom.clone(props));
|
||||
|
||||
function attachZoom(image) {
|
||||
zoomRef.current.attach(image);
|
||||
}
|
||||
|
||||
return <img ref={attachZoom} {...props} />
|
||||
return <img ref={attachZoom} {...other} />
|
||||
};
|
||||
|
||||
export default ImageZoom;
|
||||
|
|
Loading…
Reference in New Issue