BloggerAds廣告

相關文章

2014年3月31日 星期一

input password placeholder workaround IE

the workaround solution for using placeholder on IE<10
it works for IE7~10

(credits to http://jsfiddle.net/q8ajJ/)

HTML
<!-- Style = display none for people who dont have javascript -->
<input id="fake_pass" name="fake_pass" style="display: none;" type="text" value="Enter Password:" />
<input id="real_pass" name="real_pass" type="password" />


JS
// On DOM ready, hide the real password
$('#real_pass').hide();

// Show the fake pass (because JS is enabled)
$('#fake_pass').show();

// On focus of the fake password field
$('#fake_pass').focus(function(){
    $(this).hide(); //  hide the fake password input text
    $('#real_pass').show().focus(); // and show the real password input password
});

// On blur of the real pass
$('#real_pass').blur(function(){
    if($(this).val() == ""){ // if the value is empty, 
        $(this).hide(); // hide the real password field
        $('#fake_pass').show(); // show the fake password
    }
    // otherwise, a password has been entered,
    // so do nothing (leave the real password showing)
});

2014年2月7日 星期五

vertical center css

content from http://blog.themeforest.net/tutorials/vertical-centering-with-css/

In this method, we will insert a div above the content element. This will be set to height:50%; and margin-bottom:-contentheight;. The content will then clear the float and end up in the middle.

<div id="floater">
<div id="content">
 Content here
</div>
</div>
#floater {float:left; height:50%; margin-bottom:-120px;}
#content {clear:both; height:240px; position:relative;}

THE GOODS

  • Works in all browsers
  • When there isn’t enough space (ie. the window shrinks) our content will not be cut off, and a scrollbar will appear.

THE BADS

  • Only one I can think of is that it requires an extra empty element (which isn’t that bad, another subjective topic)

2013年11月11日 星期一

make a phone call on mobile using native html (no javascript needed)

simply an <a> tag:
using "tel:" protocol in the href like other protocols such as "email:", "javascript:"
<a href="tel:xxxxxxxx" >phone me</a>

if country code is needed, start with "+" and your country code,
the country in Hong kong is 852 so:
<a href="tel:+85218503">call HK Observatory</a>

example:
call 萬寧妹妹

the code were tested with the following devices using its default browser:
Galaxy S2(Android 4.0.4),
iphone 4S(IOS 5.0.1),
WinPhone 8

hope the information above can help u all