Архив

Архив Декабрь 2015
7 декабря 2015 Нет комментариев
article ul,article ol{
	list-style-type:none;
	counter-reset:num;
	margin:0 0 20px 0;
}
article ul li,article ol li{
	list-style-type:none;
	padding-left:20px;
	margin-bottom:4px;
}
article ul li:before,article ol li:before{
	color:#ffffff;
	background:#ff9300;
	border-radius:50%;
	padding:0 5px;
	text-align:center;
}
article ul li:before{
	content:"•";
}
article ol li:before{
	content:counter(num);
	counter-increment:num;
}

LESS:

.article{
	ul,ol{
		list-style-type:none;
		counter-reset:num;
		margin:0 0 20px 0;
		li{
			list-style-type:none;
			padding-left:20px;
			margin-bottom:4px;
			position:relative;
			&:before{
				position:absolute;
				top:0;
				left:0;
				color:@color_link;
				font-weight:600;
			}
		}
	}
	ul li:before{
		content:"•";
	}
	ol li:before{
		content:counter(num) ". ";
		counter-increment:num;
	}
}

Для того чтобы учитывался атрибут start у ol:

$('article ol').each(function(){
	var start=parseInt($(this).attr('start'));
	if(start>0){
		$(this).css('counter-reset','num '+(start-1));
	}
});
Categories: CSS Tags:
6 декабря 2015 Нет комментариев

Сделать что либо с элементом зная его атрибут, например

<div data-u="slides"></div>
$('div[data-u=slides]').width(window_width+'px');
Categories: Javascript Tags:
6 декабря 2015 Нет комментариев

Просто parseInt…

var window_width=parseInt($(window).width());
Categories: Javascript Tags: ,
4 декабря 2015 1 комментарий

Усовершенствованное решение этого варианта: http://krylov.org.ua/?p=1130
.htaccess

RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$
RewriteRule . %1/%2 [R=301,L]

Работает для http://site.com/dir1///dir2
но проблема остается в адресах типа http://site.com///uri (несколько слешей после домена)
Решение на php:

if(stristr($_SERVER['REQUEST_URI'],'//')){
	$uri=preg_replace('#/{2,}#','/',$_SERVER['REQUEST_URI']);
	header('Location: '.$uri,false,301);
	exit;
}
Categories: PHP, Web Tags: ,