Custom file input field

May 4th, 2012 § 0

HTML:

<span>
<input id=”photo” name=”photo” type=”file” />
<span>Choose a Photo</span>
</span>

CSS:

.file-wrapper {
cursor: pointer;
display: inline-block;
overflow: hidden;
position: relative;
}
.file-wrapper .button {
background: #79130e;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
cursor: pointer;
display: inline-block;
font-size: 11px;
font-weight: bold;
padding: 4px 18px;
text-transform: uppercase;
}
.file-wrapper input {
cursor: pointer;
height: 100%;
position: absolute;
right: 0;
top: 0;
filter: alpha(opacity=1);
-moz-opacity: 0.01;
opacity: 0.01;
font-size: 100px;
}

JavaScript:

VIGET.fileInputs = function() {
var $this = $(this),
$val = $this.val(),
valArray = $val.split('\\'),
newVal = valArray[valArray.length-1],
$button = $this.siblings('.button'),
$fakeFile = $this.siblings('.file-holder');
if(newVal !== '') {
$button.text('Photo Chosen');
if($fakeFile.length === 0) {
$button.after('' + newVal + '');
} else {$fakeFile.text(newVal);}
}
};

$(document).ready(function() {
$('.file-wrapper input[type=file]')
.bind('change focus click', VIGET.fileInputs);
});

http://viget.com/inspire/custom-file-inputs-with-a-bit-of-jquery

Best JS, Flash Ajax Galleries

August 5th, 2010 § 0

http://visionwidget.com/inspiration/web/453-javascript-flash-photo-gallery.html

http://valums.com/javascript-image-galleries/

Blinking text in IE

August 5th, 2010 § 0

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>.::.</title>
<script type="text/javascript">
var docid = null;
var interval = 1000;
function blink()
{
var el = document.getElementById(docid);
if (typeof el != 'undefined' && el)
{
vis = (el.style.visibility == 'visible') ? 'hidden' : 'visible';
el.style.visibility = vis;
setTimeout("blink()", interval);
}
}
window.onload = function()
{
docid = 'sblink';
interval = 500;
setTimeout("blink()", interval);
}
</script>
<style type="text/css">
#sblink {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #FF0000;
}
</style>
</head>

<body>
<span id="sblink">BLINK TEXT</span>
</body>

</html>

Source: http://www.ivanov.nu/blog/viewpost.php?p=8

Where Am I?

You are currently browsing the Javascript category at Aaviya Blog.