Без циклической прокрутки:
var owl_catalog_item=$('.owl_catalog_item');
owl_catalog_item.owlCarousel({
items:1,
loop:false,
margin:0,
autoplay:true,
autoplayTimeout:1000,
autoplayHoverPause:false,
dots:false,
nav:false,
navText:['<i class="fa fa-angle-left"></i>','<i class="fa fa-angle-right"></i>'],
responsive:{
0:{
},
480:{
},
768:{
}
}
});
owl_catalog_item.trigger('stop.owl.autoplay');
$('.catalog .item').on('mouseenter',function(){
if($(this).find('.owl_catalog_item a').length>1){
$(this).find('.owl_catalog_item').trigger('play.owl.autoplay',[1000]);
}
});
$('.catalog .item').on('mouseleave',function(){
$(this).find('.owl_catalog_item').trigger('stop.owl.autoplay');
$(this).find('.owl_catalog_item').trigger('to.owl.carousel',0);
});
С циклической прокруткой:
var owl_catalog_item=$('.owl_catalog_item');
owl_catalog_item.owlCarousel({
items:1,
loop:true,
margin:0,
autoplay:true,
autoplayTimeout:1000,
autoplayHoverPause:false,
dots:false,
nav:false,
navText:['<i class="fa fa-angle-left"></i>','<i class="fa fa-angle-right"></i>'],
responsive:{
0:{
},
480:{
},
768:{
}
}
});
owl_catalog_item.trigger('stop.owl.autoplay');
$('.catalog .item').on('mouseenter',function(){
$(this).find('.owl_catalog_item').trigger('play.owl.autoplay',[1000]);
})
$('.catalog .item').on('mouseleave',function(){
$(this).find('.owl_catalog_item').trigger('stop.owl.autoplay');
});
При ошибке
Access to XMLHttpRequest at 'https://site1.ru/api.php' from origin 'https://site2.ru' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
добавить на отдающий данные сайт (в примере site1.ru) заголовок
header('Access-Control-Allow-Origin: *');
В примере по клику на i
в блоке .link
скопировать ссылку внутри этого блока
function copyToClipboard(textToCopy){
if(navigator.clipboard&&window.isSecureContext){
return navigator.clipboard.writeText(textToCopy);
}
else{
let textArea=document.createElement("textarea");
textArea.value=textToCopy;
textArea.style.position="fixed";
textArea.style.left="-999999px";
textArea.style.top="-999999px";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
return new Promise((res,rej)=>{
document.execCommand('copy')?res():rej();
textArea.remove();
});
}
}
$(document).ready(function(){
$('.link i').on('click',function(){
var link=$(this).closest('.link').find('a').attr('href');
copyToClipboard(link).then(()=>console.log('copied')).catch(()=>console.log('not copied'));
});
});
Массив:
Array
(
[econom_mag] => 1800
[econom] => 510
[def] => 870
)
Ищем ключ минимального значения массива:
$min_key=array_keys($result_price,min($result_price));
print_r($min_key);
Array
(
[0] => econom
)