This is function is to limit the number of characters using jQuery.
jQuery:
function limitText($class, $limit){
jQuery("."+$class+"").each(function(){
var str = jQuery(this).text();
jQuery(this).text(str.substring(0,$limit)+"...");
});
}
limitText("limit",20);
html:
<div class="limit">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras vel mauris ut nisi suscipit condimentum quis eget magna. Integer imperdiet lacus eget mi accumsan dignissim. Donec aliquet justo odio. Donec ultrices vehicula accumsan. Nunc vulputate augue in orci aliquam auctor. Ut vel risus ante. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Duis quis viverra magna. Praesent sodales sem et magna porttitor tristique. Sed dignissim consequat odio non interdum. In est velit, volutpat semper eleifend ut, interdum eget mauris. Suspendisse dolor dui, iaculis sit amet congue eu, viverra at nunc. Duis dui dui, interdum id elementum eget, suscipit in ipsum. Pellentesque placerat laoreet cursus.</div>
OUTPUT:
Lorem ipsum dolor si...
Monday, December 19, 2011
Wednesday, November 23, 2011
Friday, November 11, 2011
My Faceblog
I'm done doing the css of my blog. Now it looks like facebook homepage. But the real thing is, this is faceblog. hahahahha:D
Tuesday, November 8, 2011
checkbox act like a radio button code:
jQuery:
jQuery('.chck').click(function(){
jQuery('.chck:checked').not(this).removeAttr('checked');
});
html:
jQuery('.chck').click(function(){
jQuery('.chck:checked').not(this).removeAttr('checked');
});
html:
<input class="chck" type="checkbox" name="chckBox"/> Mr.
<input class="chck" type="checkbox" name="chckBox"/> Mrs.
<input class="chck" type="checkbox" name="chckBox"/> Ms.
Monday, October 17, 2011
CSS for png if your using jQuery sliders or rotators
img {
background: transparent;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)"; /* IE8 */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF); /* IE6 & 7 */
zoom: 1;
}
if your using images in PNG format in your sliders or rotators... use this code to avoid black borders in IEs..
background: transparent;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)"; /* IE8 */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF); /* IE6 & 7 */
zoom: 1;
}
if your using images in PNG format in your sliders or rotators... use this code to avoid black borders in IEs..
Thursday, September 29, 2011
jQuery tagCloud random font size
jQuery:
jQuery(document).ready(function(){
function setFontSize() {
var maxFontSize = 20;
var fontSize = Math.floor(Math.random() * maxFontSize + 14) + 'px';
return fontSize;
}
jQuery('.BlogTagCloud a').each(function() {
var a = $(this);
var cssFontSize = setFontSize();
a.css({fontSize: cssFontSize});
});
});
css:
.BlogTagCloud{
width:300px;
}
.BlogTagCloud a{
text-decoration:none;
font-family:tahoma;
color:#1a1a1a;
}
html:
<div class="BlogTagCloud ">
<a href="#">Lorem </a><a href="#">sit </a>
<a href="#">dolor </a><a href="#">consectetur </a>
<a href="#">ipsum </a><a href="#">amet</a>
<a href="#">aliquip </a><a href="#">laboris </a>
<a href="#">fugiat </a><a href="#">occaecat </a>
and so on.....
</div>
jQuery(document).ready(function(){
function setFontSize() {
var maxFontSize = 20;
var fontSize = Math.floor(Math.random() * maxFontSize + 14) + 'px';
return fontSize;
}
jQuery('.BlogTagCloud a').each(function() {
var a = $(this);
var cssFontSize = setFontSize();
a.css({fontSize: cssFontSize});
});
});
css:
.BlogTagCloud{
width:300px;
}
.BlogTagCloud a{
text-decoration:none;
font-family:tahoma;
color:#1a1a1a;
}
html:
<div class="BlogTagCloud ">
<a href="#">Lorem </a><a href="#">sit </a>
<a href="#">dolor </a><a href="#">consectetur </a>
<a href="#">ipsum </a><a href="#">amet</a>
<a href="#">aliquip </a><a href="#">laboris </a>
<a href="#">fugiat </a><a href="#">occaecat </a>
and so on.....
</div>
jQuery Loading
jQuery:
jQuery(window).load(function() {
jQuery("#welcome").fadeOut('fast');
});
css:
#welcome{
width:100%;
height:100%;
z-index:15;
position:fixed;
top:0;
left:0;
background:url("../images/loading3.gif") no-repeat center #ffffff;
opacity:0.8;
filter: alpha(opacity = 80);
}
html:
<div id="welcome"></div>
jQuery(window).load(function() {
jQuery("#welcome").fadeOut('fast');
});
css:
#welcome{
width:100%;
height:100%;
z-index:15;
position:fixed;
top:0;
left:0;
background:url("../images/loading3.gif") no-repeat center #ffffff;
opacity:0.8;
filter: alpha(opacity = 80);
}
html:
<div id="welcome"></div>
jQuery GET
jQuery:
function getQuerystring(key, default_)
{
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}
var author_value = getQuerystring('author');
function changetoSpace($str){
$str= $str.replace("%20"," ");
return $str;
}
var a=unescape(author_value);
URL:
http://test.com?author=reyneil
OUTPUT:
reyneil
function getQuerystring(key, default_)
{
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}
var author_value = getQuerystring('author');
function changetoSpace($str){
$str= $str.replace("%20"," ");
return $str;
}
var a=unescape(author_value);
URL:
http://test.com?author=reyneil
OUTPUT:
reyneil
Monday, August 22, 2011
custom webform
Web forms enable visitors to inquire online and contact the owners of small businesses. This system provides the functionality to build forms that can alternately store the form data in the backend database or forward the data submitted in the form to an email address.
Tuesday, July 19, 2011
my favorite quotes
fate brings us together but it's up to us to make it happen
-reyneil
Don't set compensation as a goal. Find work you like,
and the compensation will follow.
-anonymous
Most good programmers do programming not because they
expect to get paid or get adulation by the public,
but because it is fun to program.
-anonymous
-reyneil
Don't set compensation as a goal. Find work you like,
and the compensation will follow.
-anonymous
Most good programmers do programming not because they
expect to get paid or get adulation by the public,
but because it is fun to program.
-anonymous
Tuesday, June 21, 2011
Subscribe to:
Posts (Atom)