Articles
7915 Articles
Disable Parent Links in Nested List Navigation
jQuery code that disables parent links for drop down menus. The menu should be built as nested lists, and the parent link is disabled. This helps eliminate a useless page to display only a list of links to the pages …
Chris Coyier
on
Scale on Hover with Transition
Bring your own prefixes!
.grow { transition: all .2s ease-in-out; }
.grow:hover { transform: scale(1.1); }
…
Chris Coyier
on
(Updated on )
Force charset utf-8
If you can not change the configuration of Apache server, use this code to force decoding of page to utf-8.
AddDefaultCharset utf-8
…
Chris Coyier
on
Get Image Information
/*
* @param string $file Filepath
* @param string $query Needed information (0 = width, 1 = height, 2 = mime-type)
* @return string Fileinfo
*/
function getImageinfo($file, $query) {
if (!realpath($file)) {
$file = $_SERVER["DOCUMENT_ROOT"].$file;
}
$image = getimagesize($file);
…
Chris Coyier
on
Get File Last Updated Date
/*
* @param string $file Filepath
* @param string $format dateformat
* @link http://www.php.net/manual/de/function.date.php
* @link http://www.php.net/manual/de/function.filemtime.php
* @return string|bool Date or Boolean
*/
function getFiledate($file, $format) {
if (is_file($file)) {
$filePath = $file;
if (!realpath($filePath)) {
$filePath = $_SERVER["DOCUMENT_ROOT"].$filePath;
…
Chris Coyier
on
Make Random Number
function getRandomId($min = NULL, $max = NULL) {
if (is_numeric($min) && is_numeric($max)) {
return mt_rand($min, $max);
}
else {
return mt_rand();
}
}
…
Chris Coyier
on
Get File Size
/*
* @param string $file Filepath
* @param int $digits Digits to display
* @return string|bool Size (KB, MB, GB, TB) or boolean
*/
function getFilesize($file,$digits = 2) {
if (is_file($file)) {
$filePath = $file;
if (!realpath($filePath)) {
$filePath =
…
Chris Coyier
on
#70: Random Pet Peeves
I just randomly go through some little annoyances and gripes I have with everything from OS X to Photoshop to WordPress to CSS. I thought of about 5 more the second I was done, but I’ll spare you!…
Chris Coyier
on
(Updated on )