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