Архив

Октябрь 2016

Всего: 4 записи

jquery live hover

Правильный вариант:

$('.cart_item_morecount input[type=text]').live('mouseover mouseout',function(){
	if(event.type=='mouseover'){
		$(this).parent().find('.morecount').show();
	}
	else{
		$(this).parent().find('.morecount').hide();
	}
});

Не удастся код:

$('.cart_item_morecount input[type=text]').hover(function(){
	$(this).parent().find('.morecount').show();
},function(){
	$(this).parent().find('.morecount').hide();
});

записать как:

$('.cart_item_morecount input[type=text]').live('hover',function(){
	$(this).parent().find('.morecount').show();
},function(){
	$(this).parent().find('.morecount').hide();
});

php — array_unique без учета регистра utf-8

Оставить уникальные элементы массива, не учитывая регистр, сохранив исходный регистр. Кодировка utf-8.

function strtolower_utf8($a){ 
	return mb_strtolower($a,'UTF-8'); 
}
function array_iunique($array) {
	return array_intersect_key(
		$array,
		array_unique(array_map("strtolower_utf8",$array))
	);
}
$result=array_iunique($result);