Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

Tuesday, June 9, 2009

Use This Smart "Expando" CSS&JS Tricks!!

0 comments

Learn this trick to add more interesting to your content by expanding your images in your posts, This simple script for folks who want to have an image expand onMouseover (Set its to actual size).







Expando Image is AJAX friendly, meaning imported content with images with the "expando" class will be immediately recognized by the script.


● Installation is simple- install the script in the HEAD section of the page, then give your "thumbnail" images a CSS class of "Expando"



To do it just follow this simple two steps, In the first as usual copy/paste this code in head area or between <head>...here...</head> tags:
<style type="text/css">
img.expando{ /*sample CSS for expando images. Not required but recommended*/
border: none;
vertical-align: top; /*top aligns image, so mouse has less of a change of moving out of image while image is expanding*/
}
</style>
And this:
<script type="text/javascript">
//<![CDATA[
/* Expando Image Script ©2008 John Davenport Scheuer
as first seen in http://www.dynamicdrive.com/forums/
username: jscheuer1 - This Notice Must Remain for Legal Use
*/

if (document.images){
(function(){
var cos, a = /Apple/.test(navigator.vendor), times = a? 20 : 40, speed = a? 40 : 20;
var expConIm = function(im){
im = im || window.event;
if (!expConIm.r.test (im.className))
im = im.target || im.srcElement || null;
if (!im || !expConIm.r.test (im.className))
return;
var e = expConIm,
widthHeight = function(dim){
return dim[0] * cos + dim[1] + 'px';
},
resize = function(){
cos = (1 - Math.cos((e.ims[i].jump / times) * Math.PI)) / 2;
im.style.width = widthHeight (e.ims[i].w);
im.style.height = widthHeight (e.ims[i].h);
if (e.ims[i].d && times > e.ims[i].jump){
++e.ims[i].jump;
e.ims[i].timer = setTimeout(resize, speed);
} else if (!e.ims[i].d && e.ims[i].jump > 0){
--e.ims[i].jump;
e.ims[i].timer = setTimeout(resize, speed);
}
}, d = document.images, i = d.length - 1;
for (i; i > -1; --i)
if(d[i] == im) break;
i = i + im.src;
if (!e.ims[i]){
im.title = '';
e.ims[i] = {im : new Image(), jump : 0};
e.ims[i].im.onload = function(){
e.ims[i].w = [e.ims[i].im.width - im.width, im.width];
e.ims[i].h = [e.ims[i].im.height - im.height, im.height];
e (im);
};
e.ims[i].im.src = im.src;
return;
}
if (e.ims[i].timer) clearTimeout(e.ims[i].timer);
e.ims[i].d = !e.ims[i].d;
resize ();
};

expConIm.ims = {};

expConIm.r = new RegExp('\\bexpando\\b');

if (document.addEventListener){
document.addEventListener('mouseover', expConIm, false);
document.addEventListener('mouseout', expConIm, false);
}
else if (document.attachEvent){
document.attachEvent('onmouseover', expConIm);
document.attachEvent('onmouseout', expConIm);
}
})();
}
//]]>
</script>
In the second when you posting and before adding images just copy your image look like this ex.code:
<p>
<img class="expando" border="0" src="Your Image Url" width="100" height="75">
</p>
If you see we add the expando class to order the script, Now you can change values for width and height.

Have fun, Well done (-;
Read full story

Tuesday, June 2, 2009

How To Add Javascripts Directly Without Javascript Hosting "For Blogger Users"

4 comments
Many of the bloggers who's blogging for programming posts don't have javascript hosting site to upload any javascript file to order any javascript code so i found two methods to solve your javascript code to add in your blogger template or what you want.

 
In the first method is we add some changes in javascript source code before adding it for example any js code must look like this:

<script type="text/javascript" src="Javascript file.js">
bla, bla, bla

</script>
All you will do just copy all the content of the Javascript file.js and then copy in this new javascript code:
<script type='text/javascript'>
//<![CDATA[
SCRIPT_CONTENT
//]]>
</script>
The second method also you can upload Javascript file.js but in TXT format not JS format and put the new link look like this:
<script type="text/javascript" src="Same js but in new format.TXT" /> 
</script>
Read full story
 
http://www.wikio.com Blog Search Web Design Directory of Web Development Blogs Top Marketing SEO  blogs Hit It! blog search directory podcast directory Free Trial of Our Professional Search Engine Submission Service Blog Directory

Hello

 

 

 

BProfile

My photo
Be Hungry For Success.

Followers

^^^Back to Top Page^^^