It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Need some help here

Need some help here

Postby IM.Style on Fri Dec 21, 2007 1:41 pm

Hey guys, may i know how can i make a image popup mouseover effect like the one in google.co.kr?
try to put your cursor on Gmail
how can i make that?
IM.Style
 
Posts: 3
Joined: Fri Dec 21, 2007 1:37 pm

Postby leonard on Fri Dec 21, 2007 2:49 pm

This is a tricky one. It has something to do with the JavaScripts on gmodules.com.
But I dont know how it works, because the code is not really readable... probably generated dynamically :-).

My best guess would be:
The images are somehow extracted from
Image
and the text-bubbles are moved by JavaScript with HTML-layers and the transparency of the layers is modified too.

A simple version of this would probably be to have non-looping animated gif's triggered by onmouseover/onmouseout.

cheers!
- leonard
:%s/^M//
There are 10 kinds of people:
Those who understand binary and those who don't.
User avatar
leonard
100+ Club
 
Posts: 147
Joined: Tue Dec 18, 2007 7:11 am
Location: Switzerland

Postby IM.Style on Fri Dec 21, 2007 5:50 pm

Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<title>test</title>
<style type="text/css">
<!--
body {text-align:center}
table {border:1px solid #eeeeee;padding:3px 0;border-bottom-width:5px}
.icon td {width:50px;height:37px;background-image:url(http://bbs.6co.cn/a/b/svc_sprite_all.gif)}
.capt td {font:normal 11px verdana;padding:2px 0}
.a {background-position-y:0px}
.b {background-position-y:-37px}
.c {background-position-y:-74px}
.d {background-position-y:-111px}
.e {background-position-y:-148px}
.f {background-position-y:-185px}
.g {background-position-y:-222px}
.f1 {background-position-x:0px}
.f2 {background-position-x:-51px}
.f3 {background-position-x:-101px}
.f4 {background-position-x:-153px}
.f5 {background-position-x:-205px}
.f6 {background-position-x:-257px}
.f7 {background-position-x:-309px}
-->
</style>
<script language="javascript">
window.onload=function(){
   var t=document.getElementsByTagName('table')[0];
   var cs=t.rows[1].cells,ct=t.rows[0].cells;
   for(var i=0;i<cs.length;i++)
     cssAni(cs[i],ct[i],7);
}
function cssAni(osrc,otarget,num,duration){
   ////////
   //IE only
   //by mozart0, 2007.06.09
   ////////
   var t=null,c=1,d=0,n=0,i=Math.floor((duration||300)/num);
   var s=otarget.className.replace(/.$/,''),r=/over/;
   osrc.onmouseover=osrc.onmouseout=function(e){
     n=r.test((e||event).type)?1:-1;
     if(!t) t=setInterval(function(){
       if((c==1||c==num)&&((d==n||c+n<1)||!(d=n)))
           return clearInterval(t),t=null;
       otarget.className=s+(c+=d);
     },i);
   };
}
</script>
</head>
<body>
<table>
   <tr class='icon'>
     <td class='a f1'></td>
     <td class='b f1'></td>
     <td class='c f1'></td>
     <td class='d f1'></td>
     <td class='e f1'></td>
     <td class='f f1'></td>
     <td class='g f1'></td>
   </tr>
   <tr class='capt'>
     <td><a href='#;'>A</a></td>
     <td><a href='#;'>B</a></td>
     <td><a href='#;'>C</a></td>
     <td><a href='#;'>D</a></td>
     <td><a href='#;'>E</a></td>
     <td><a href='#;'>F</a></td>
     <td><a href='#;'>G</a></td>
   </tr>
</table>
</body>
</html>


this is the code where i found it on a chinese forum.
It's actually an imitation the one in google korea.
but can anyone please explain the code for me please.
anyways, thanks for your reply leonard. :D
IM.Style
 
Posts: 3
Joined: Fri Dec 21, 2007 1:37 pm

Postby leonard on Sat Dec 22, 2007 9:28 pm

I must say, this is really neat.
This code is really much more readable than the one I looked upon on the korean site.

I have put the answer to a new topic, so that is has a better meaning:
animated-css-rollover-images-by-google-vt8815.html

cheers
- leonard
:%s/^M//
There are 10 kinds of people:
Those who understand binary and those who don't.
User avatar
leonard
100+ Club
 
Posts: 147
Joined: Tue Dec 18, 2007 7:11 am
Location: Switzerland


Who is online

Users browsing this forum: No registered users and 3 guests