document.querySelector("#_snup-target21").innerHTML = '
trending recipes
'; window.ahm_trx2_curptr = 0; window.ahm_trx2_maxptr = 3; window.ahm_trx2_container = "#ahm-trx2"; function ahm_rotateTRX2() { var curptr = "div" + window.ahm_trx2_container + " div.ahm_trx2-thumb"; var _tumbs = document.querySelectorAll(curptr); var _doots = document.querySelectorAll("div" + window.ahm_trx2_container + " span.ahm-trx2-indicat"); _tumbs[window.ahm_trx2_curptr].classList.add("ahm_trx2-thumbnon"); //current dot disabled _doots[window.ahm_trx2_curptr].classList.remove("ahm-trx2-active"); //opacity 1 next window.ahm_trx2_curptr++; if ( window.ahm_trx2_curptr > window.ahm_trx2_maxptr ) { window.ahm_trx2_curptr = 0; } _tumbs[window.ahm_trx2_curptr].classList.remove("ahm_trx2-thumbnon"); //new dot active _doots[window.ahm_trx2_curptr].classList.add("ahm-trx2-active"); } //new dot active window.setTimeout( function() { var _doots = document.querySelectorAll("div" + window.ahm_trx2_container + " span.ahm-trx2-indicat"); _doots[window.ahm_trx2_curptr].classList.add("ahm-trx2-active"); window.ahm_trx2_rotator = window.setInterval( ahm_rotateTRX2, 5000 ); }, 5 ); document.querySelector(window.ahm_trx2_container).addEventListener("mouseover", function() { window.clearInterval(window.ahm_trx2_rotator) }); document.querySelector(window.ahm_trx2_container).addEventListener("mouseout", function() { window.ahm_trx2_rotator = window.setInterval( ahm_rotateTRX2, 5000 ); }); var _ahm_trx2_indicatr = 0; var _ahm_trx2_indicats = document.querySelectorAll(window.ahm_trx2_container + " span.ahm-trx2-indicat"); for ( let _ahm_trx2_indicatr = 0; _ahm_trx2_indicatr < _ahm_trx2_indicats.length; _ahm_trx2_indicatr++ ) { _ahm_trx2_indicats[_ahm_trx2_indicatr].addEventListener('click', event => { console.log( _ahm_trx2_indicatr ); ahm_rotateTRX2_force( window.ahm_trx2_container, _ahm_trx2_indicatr ); }); } function ahm_rotateTRX2_force( id, cur ) { var curptr = "div" + id + " div.ahm_trx2-thumb"; var _tumbs = document.querySelectorAll(curptr); var _doots = document.querySelectorAll("div" + id + " span.ahm-trx2-indicat"); _tumbs[window.ahm_trx2_curptr].classList.add("ahm_trx2-thumbnon"); //current dot disabled _doots[window.ahm_trx2_curptr].classList.remove("ahm-trx2-active"); //opacity 1 next window.ahm_trx2_curptr = cur; _tumbs[window.ahm_trx2_curptr].classList.remove("ahm_trx2-thumbnon"); //new dot active _doots[window.ahm_trx2_curptr].classList.add("ahm-trx2-active"); }