test
parent
924d48bda1
commit
9129ea9da0
|
@ -55,6 +55,27 @@
|
|||
console.log(this);
|
||||
this.video = this.querySelector('video');
|
||||
|
||||
if(!this.video) {
|
||||
console.error('No video element found');
|
||||
|
||||
|
||||
// create observer to watch for new video elements
|
||||
const observer = new MutationObserver(function(mutations) {
|
||||
mutations.forEach(function(mutation) {
|
||||
mutation.addedNodes.forEach(function(node) {
|
||||
if (node.classList && node.classList.contains('shx-video-card-product')) {
|
||||
this.connectedCallback();
|
||||
console.log('new video added', node);
|
||||
}
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("video",this.video);
|
||||
|
||||
// get parrent with class "card-wrapper product-card-wrapper"
|
||||
this.productCard = this.video.closest('.product-card-wrapper');
|
||||
console.log(this.productCard);
|
||||
|
|
Loading…
Reference in New Issue