martes, 5 de febrero de 2013

Filled Under: ,

Mostrar datos adicionales con algo de estilo y hover – Motor – Domains – programmers

Eso del estilo va porque vamos a jugar un poco con las propiedades CSS, no porque las sugerencias que planteo como ejemplos sean una virguería estética.

Se trata de algo tan sencillo y vistoso a la vez, como hacer aparecer información adicional sobre una imagen al pasar el puntero por encima de ella. Para esto vamos a echar mano de cosas que ya hemos visto en otras ocasiones. Básicamentez-index,position yopacity.

La teoría es que montamos una caja dentro de la cual irá una imagen con enlace y dentro del mismo enlace unspan con los datos (texto). Como solaparemos esos elementos en el mismo espacio, el orden lo marcamos conz-index, de manera que el texto quede por encima de la imagen. Como inicialmente no queremos que se vea, le añadiremos también una opacidad (opacity:0;) haciéndolo inicialmente transparente (no visible).

El cambio vendrá con elhover sobre la caja principal, momento en el cual la transparencia será nula (bueno, casi) dejando ver los datos antes comentados.

En la práctica estamos hablando de algo así, pero luego lo complicaremos un poco más:



La explicación sobre el código CSS:

.caja {
position: relative; /*Para poder ubicar la info dentro de la caja*/
margin: 10px auto;
}
.caja img {
border:2px solid black;
}
.info {
position: absolute; /*Info sobre la imagen*/
top: 5%;
left: 10%; /*Desplazamos a partir de la esquina superior izquierda*/
zoom: 1;
filter: alpha(opacity=0); /*Opacidad Para IE */
opacity: 0; /*Inicialmente transparente */
padding: 5px;
color: white;
background: black;
-moz-transition:all ease .8s; /*Aplicamos una ligera transición*/
-webkit-transition:all ease .8s ;
transition:all ease .8s;
}
.caja:hover .info {
filter: alpha(opacity=80);
opacity: .8; /*Al hacer hover sobre la caja hacemos visible los datos*/
}

Con esto anterior en nuestra parte de estilo (entre las etiquetasskin) ya sólo tendremos que crear el HTML con esta estructura para que la cosa salga como en la demo:

div class="caja"a href="URL_ENLACE"img src="URL_IMAGEN" /span class="info"TEXTO/span/a/div



Y con esa misma estructura podemos hacer otras cosas si cambiamos un poco el estilo y en lugar de sólo texto añadimos más cosas mediante un segundospan con una nueva clase. Pasa el puntero por esta otra imagen.



.caja2 {
position: relative;
width: 300px;
margin: 10px auto;
}
.caja2 img {
position: relative;
z-index:2; /*Imagen apilada en segunda posición*/
border: 1px solid #333;
box-shadow: 1px 1px 4px #333;
}
.disco {
position: absolute;
top:0;
left:0px;
z-index:1; /*La imagen del disco por debajo de la principal*/
display:block;
width: 300px;
height:300px;
background:url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVvLQzXczrWd5sa8N51FQ4GnTuScjJ0sVPYJcaqMRHhrUZj71Wd7spN9rrEgzp47QhYVQD92M2OqLlyZ6_eXQxuhRFFarBNSNlMMsCdLNIXLNNQQ2FmPYFVx4yx53jlaCEjqFMokf_qDA/s300/vinilo.png") no-repeat scroll center center transparent;
-moz-transition:all linear 0.5s 0s;
-webkit-transition:all linear 0.5s 0s;
transition:all ease 0.5s 0s;
}
.info2 {
position: absolute;
z-index: 3; /*Los datos por encima de todo lo demás*/
top: 30%;
zoom: 1;
filter: alpha(opacity=0);
opacity: 0;
padding: 5px;
text-align: center;
color: #eee;
background: #333;
background: rgba(0,0,0,.7);
-moz-transition:all linear 0.5s 0s;
-webkit-transition:all linear 0.5s 0s;
transition:all ease 0.5s 0s;
}
.caja2:hover .info2, .caja2:hover .disco {
filter: alpha(opacity=100);
opacity:1;
}
.caja2:hover .disco {
left:100px; /*Para hacer "salir" parcialmente el disco*/
-moz-transform:rotate(180deg); /*Y además lo hace girando*/
-webkit-transform:rotate(180deg);
transform:rotate(180deg);
}

En el HTML añadimos un segundospan que tendrá como fondo la imagen del disco. En este caso debe tener el fondo transparente (GIF o PNG):

div class="caja2"a href="URL_ENLACE"img src="URL_IMAGEN" /span class="info2"TEXTO/spanspan class="disco"/span/a/div


Por último otra idea en la misma línea añadiendo untriangulito al rótulo, animándolo con un volteo y superponiendo una segunda imagen que aparece poco a poco. Como antes, hemos cambiado la opacidad para el efecto del rótulo, pero para el de la segunda imagen hemos jugado con unheight inicial igual a cero.

A diferencia del anterior ejemplo, aquí la imagen "móvil" no será fija como sí que era el disco, así que no podemos ponerla como fondo (background). La añadiremos también con unspan y la clase oportuna, pero con libertad de añadir la imagen que queramos desde allí.

LE PETIT IDÉE



.caja3 {
position: relative;
width: 300px;
margin: 10px auto;
}
.caja3 img {
width: 300px;
border: 3px solid #333;
-moz-box-shadow: 1px 1px 4px #333;
-webkit-box-shadow: 1px 1px 4px #333;
box-shadow: 1px 1px 4px #333;
}
.info3 {
position: absolute;
top: 30%;
opacity: 0;
width: 200px;
height: 110px;
padding: 5px;
text-align: left;
color: #eee;
background: #C14684; /*Para IE que no soporta RGBA*/
background: rgba(193,70,132,.8);
-moz-transform:rotate(180deg); /*Inicialmente boca abajo*/
-webkit-transform:rotate(180deg);
transform:rotate(180deg);
-moz-transition:all linear 0.5s 0s;
-webkit-transition:all linear 0.5s 0s;
transition:all ease 0.5s 0s;
}
.info3:after {
position: absolute;
top: 0;
right: -120px;
content:"";
display:block; /*Lo siguiente monta el triángulo*/
width:0;
height:0;
border-color:transparent transparent transparent #C14684;
border-color:transparent transparent transparent rgba(193,70,132,.8);
border-style:solid;
border-width:60px;
}
.imagen img {
position: absolute;
top:0;
border: 0;
height: 0; /*Segunda imagen no visible inicialmente*/
-moz-transition:all linear 0.5s 0s;
-webkit-transition:all linear 0.5s 0s;
transition:all ease 0.5s 0s;
}
.caja3:hover .info3 {
filter: alpha(opacity=100);
opacity: 1;
left:-100px;
-moz-transform:rotate(0deg);
-webkit-transform:rotate(0deg);
transform:rotate(0deg);
}
.caja3:hover .imagen img {
top:0;
left:0;
height:450px !important;
border: 3px solid #333;
}

div class="caja3"a href="URL_ENLACE"img src="URL_IMAGEN" /span class="imagen"img src="URL_IMAGEN2" //spanspan class="info3"TEXTO/span/a/div


A partir de aquí el resto de posibles variaciones os las dejo a vosotros ;)

MESOTHELIOMA LAW FIRMDONATE CAR TO CHARITY CALIFORNIAHARDDRIVE DATA RECOVERY SERVICESDONATE A CAR IN MARYLAND DONATING A CAR IN MARYLAND,DONATE CARS ILLINOIS,CRIMINAL DEFENSE ATTORNEYS FLORIDA ,BEST CRIMINAL LAWYER IN ARIZONASTRUCTURED ANNUITY SETTLEMENT,ASBESTOS LAWYERS,NUNAVUT CULTURE,DAYTON FREIGHT LINES ,Bextra Bankruptcy Dental Plan Private JetMundial Football Perros,FIFA World Cup Peinados caninos,Veterinarios caninos,MESOTHELIOMA LAW FIRM,MESOTHELIOMA LAW FIRM,DONATE CAR TO CHARITY CALIFORNIA ,DONATE CAR FOR TAX CREDIT,DONATE CARS IN MA,DONATE YOUR CAR SACRAMENTO,HOW TO DONATE A CAR IN CALIFORNIA,SELL ANNUITY PAYMENT,DONATE YOUR CAR FOR KIDS,ASBESTOS LAWYERS,DONATE YOUR CAR FOR KIDS ,Selling annuity payments for cashSelling annuity payments for cash,Sell my structured settlement,Sell structured settlement,Structured settlement,Structured settlement companies,Sell my annuity payments lump sum,Car accident lawyer Denver,Accident injury attorneys,Sell my annuity

MESOTHELIOMA LAW FIRMDONATE CAR TO CHARITY CALIFORNIAHARDDRIVE DATA RECOVERY SERVICESDONATE A CAR IN MARYLAND DONATING A CAR IN MARYLAND,DONATE CARS ILLINOIS,CRIMINAL DEFENSE ATTORNEYS FLORIDA ,BEST CRIMINAL LAWYER IN ARIZONASTRUCTURED ANNUITY SETTLEMENT,ASBESTOS LAWYERS,NUNAVUT CULTURE,DAYTON FREIGHT LINES ,Bextra Bankruptcy Dental Plan Private JetPero tuve que ser Mundial Football consolidating FIFA World Cup web host rating,register web address,online psychology degree,her first lesbian sex, make extra money ,make money fast and easy,addwords y mejor obtuve un credit application,visa gift carda,Mesothelioma law firm,voip phone service,Selling annuity payments for cash,Sell my structured settlement,Sell structured settlement,Structured settlement,Structured settlement companies,Sell my annuity payments lump sum,Car accident lawyer Denver,Accident injury attorneys,Sell my annuity

MOTOR REPLACEMENTS Casino AUTOMOBILE ACCIDENT ATTORNEY Holland Michigan College WebEx costs Mobile casino Computer science classes online Online Classes CHEAP AUTO INSURANCE IN VA Car Insurance Quotes Psychic for Free workers compensation lawyer los angeles Car Insurance Quotes Utah WordPress theme designers Low Credit Line Credit Cards sell annuity payment Online casino Casino reviews structured settlement sell tucson car accident attorney miami personal injury lawyer motorcycle accident attorney chicago mesothelioma claim alabama mesothelioma lawyer Cheap Domain Registration Hosting lease management software ashely madis Learning adobe illustrator houston tx auto insurance earthlink business internet Christmas cards mesotheolima DUI lawyer PSYCHIC FOR FREE Donate Car to Charity California WordPress hosting selling annuity payments for cash adverse credit remortgage yahoo web hosting Make money online Australia DONATE YOUR CAR FOR MONEY Business VOIP Solutions mesothelioma attorneys california georgia truck accident lawyer CAR INSURANCE QUOTES COLORADO Futuristic Architecture Social media platforms Email Bulk Service Donate Car To Charity CALIFORNIA Php programmers for hire Criminal Defense Attorneys Florida structured settlement agreement DONATE CARS IN MA New social media platforms cheap auto insurance in va mesothelioma law suit saskatchewan auto insurance Donate Your Car for Kids donate old cars to charity Auto Accident Attorney mesothelioma compensation mesothelioma law firm Photo Christmas cards Best social media platforms for business domain registration yahoo mesothelioma survival rates Donate your Car for Money adverse remortgage BETTER CONFERENCING CALLS PHD IN COUNSELING EDUCATION Attorney Live casino FUTURISTIC ARCHITECTURE uk homeowner loans LIFE INSURANCE CO LINCOLN CAR INSURANCE IN SOUTH DAKOTA Hire php developers Social media strategies Criminal defense lawyer buying an annuity calculator Social media campaigns Hire php programmers mesothelioma charities Donate your car for kids paperport promotional code Dwi lawyer la personal injury lawyer Motor Replacements Insurance Companies mesothelioma lawyer houston Donate old cars to charity Seo company criminal defense federal lawyer Php programmers Criminal lawyer ONLINE MOTOR INSURANCE QUOTES Service business software Social media management mesothelioma law firms Hire php developer selling my structured settlement Bankruptcy lawyer online criminal justice degree Life insurance co Lincoln best mesothelioma lawyers average mesothelioma settlement most profitable internet business mesothelioma lawyer asbestos cancer lawsuit Seo services Seo companies Social media platforms for business structured settlements annuities mesothelioma lawyer dallas better conferencing calls structured settlement purchasers Donating a Car in Maryland mesothelioma drug best consolidation loan student Auto Mobile Shipping Quote structured settlement broker Online colledges Business Voip Solutions Online Christmas cards Business finance group Custom WordPress theme designer Best Seo company DONATE OLD CARS TO CHARITY Business management software Best social media platforms Massage School Dallas Texas mesothelioma lawyer virginia WEBEX COSTS personal injury attorney ocala fl canada personals yahoo SELL ANNUITY PAYMENT car accident lawyers west palm beach Custom Christmas cards Dallas mesothelioma attorneys ANNUITY SETTLEMENT CHEAP CAR INSURANCE IN VIRGINIA WordPress themes for designers car insurance quotes pa Psd to WordPress Structures Annuity Settlement semi truck accident lawyers life insurance quotes Social media examiner google affiliate Tech school city college in miami Html email car crash attorneys motorcycle accident lawyer san francisco injury lawyers Proud Italian cook Psd to html Italian cooking school PhD in counseling education structured settlement company st louis mesothelioma attorney pharmacist jobs in chicago Donate Your Car Sacramento Adobe illustrator classes federal criminal defense attorney Donating Used Cars to Charity Social media tools personal injury accident lawyer mesothelioma lawyer texas CAR INSURANCE QUOTES PA anti spam exchange server DAYTON FREIGHT LINES asbestos exposure lawyers Donate Car for Tax Credit auto insurance yuba city ca Mesothelioma Law Firm DONATING A CAR IN MARYLAND Online College Course Met auto Donate Cars in MA houston motorcycle accident lawyer How to Donate A Car in California DONATE YOUR CAR SACRAMENTO massage school dallas texas Sell Annuity Payment DALLAS MESOTHELIOMA ATTORNEYS Asbestos Lawyers mesotheloma Car Insurance Quotes Colorado Neuson Motor Insurance Quotes Annuity Settlements Hard drive data recovery services Nunavut Culture Donate your car for money Dayton Freight Lines Data Recovery Raid Donate a Car in Maryland car accident lawyers los angeles Hard drive Data Recovery Services houston mesothelioma attorney asbestos lawyers BEST CRIMINAL LAWYER IN ARIZONA hair removal washington dc Donate Cars Illinois Best Criminal Lawyers in Arizona Donate car for tax credit Injury Lawyers mesothelioma help Life Insurance Co Lincoln car accident lawyers