Clicking link returns page to top - html

I set images so when you click them they each reveal a different div underneath them.
I found the original code here: http://www.dynamicdrive.com/forums/showthread.php?74782-Changing-content-in-Div-upon-Link-Click
Here is my code:
#workSamples {
width:960px;
margin:auto;
}
#button1 {
width:300px;
height:236px;
display:inline-block;
float:left;
margin:0px 10px 20px 10px;
-webkit-box-shadow: 0px 0px 8px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 0px 8px rgba(50, 50, 50, 0.75);
box-shadow: 0px 0px 8px rgba(50, 50, 50, 0.75);
}
.b1 {
width:300px;
height:236px;
overflow:hidden;
}
.b1 img {
height:auto;
-webkit-transition: margin 1s ease;
-moz-transition: margin 1s ease;
-o-transition: margin 1s ease;
-ms-transition: margin 1s ease;
transition: margin 1s ease;
}
.b1 img:hover {
margin-top: -236px;
}
#button2 {
width:300px;
height:236px;
display:inline-block;
float:left;
margin:0px 10px 0px 10px;
-webkit-box-shadow: 0px 0px 8px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 0px 8px rgba(50, 50, 50, 0.75);
box-shadow: 0px 0px 8px rgba(50, 50, 50, 0.75);
}
#button3 {
width:300px;
height:236px;
display:inline-block;
float:left;
margin:0px 10px 0px 10px;
-webkit-box-shadow: 0px 0px 8px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 0px 8px rgba(50, 50, 50, 0.75);
box-shadow: 0px 0px 8px rgba(50, 50, 50, 0.75);
}
#button1:focus~#content #def,
#button2:focus~#content #def,
#button3:focus~#content #def,
#button4:focus~#content #def {display:none;}
#button1:focus~#content div:nth-child(2),
#button2:focus~#content div:nth-child(3),
#button3:focus~#content div:nth-child(4),
#button4:focus~#content div:nth-child(5) {display:block;}
#content {
width:940px;
height:307px;
color:black;
font-size:10px;
text-align:center;
margin:20px auto;
-webkit-box-shadow: 0px 0px 8px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 0px 8px rgba(50, 50, 50, 0.75);
box-shadow: 0px 0px 8px rgba(50, 50, 50, 0.75);
overflow:hidden;
background:red;
}
.caption {
background:blue;
width:200px;
margin:auto;
height:60px;
background:#694264;
-webkit-transition:all .3s ease-out;
-moz-transition:all .3s ease-out;
-o-transition:all .3s ease-out;
-ms-transition:all .3s ease-out;
transition:all .3s ease-out;
left:0;
font-size:14px;
padding:10px;
}
#content:hover .caption {
-moz-transform:translateY(-100%);
-o-transform:translateY(-100%);
-webkit-transform:translateY(-100%);
transform:translateY(-100%);
}
#faq,#her,#and,#enj {display:none;}
#faq:hover{
background:red;
}
<section class="top" data-type="background" data-speed="10" class="pages">
<section id="w">
<div class="title">My Work</div>
<div id="workSamples">
<a id="button1" href="#" tabindex="1"><div class="b1"><img src="Images/work/sample01.jpg" alt=""></div></a>
<a id="button2" href="#" tabindex="2"><div class="b1"><img src="Images/work/sample02.jpg"></div></a>
<a id="button3" href="#" tabindex="3"><div class="b1"><img src="Images/work/sample03.jpg"></div></a>
<div id="content">
<div id="def">This is where I put the default information. No clicks needed </div>
<div id="faq"><img src="Images/absolutebeauty.jpg">
<div class="caption">
<a href="http://www.absolutebeauty.ie">
<h4>Absolute Beauty</h4><br>Visit the site</a>
</div>
</div>
<div id="her"><img src="Images/bestacoustic.jpg"></div>
<div id="and"><img src="Images/engagement.jpg"></div>
</div>
</div>
</section>
</section>
The code works well on it's own but when I added it to my site it now returns me to the top of the page when I click on the first image link.
Here is my site: http://www.liddily.com
Click work and click on any of the images, you will see what I mean.
I don't know why this is happening. Can someone please help me out?
Thanks for reading!

You have your links set up to go to an anchor that isn't there so it returns the page itself. Return
make these link to an actual location and the "refresh" effect will stop.
Notice in the example on that site it shows the following code with locations after the hash # :
<div id="button1"><img src="http://img62.imageshack.us/img62/3523/p42e.png"></div>
<div id="button2"><img src="http://img16.imageshack.us/img16/3742/lnam.png"></div>
<div id="button3"><img src="http://img829.imageshack.us/img829/2347/kflq.png"></div>
<div id="button4"><img src="http://img24.imageshack.us/img24/5111/zv9.png"></div>
<div id="content"> This is where I put the default information. No clicks needed </div
<a name="FAQ">
<div style="border: 1px dashed black;width: 300px;height:500px;position:fixed;left:750px;top:150px;}
FAQ content will go here.
And then the example shows a named location for the link to travel to. you need to implement this format for it to work.

Related

Why Inline-block is not doing what I am expecting?

Roughly a week ago all my divs were properly aligned on the same line.
I'm not sure what I did to cause them to stack. "fbox" is set to inline-block but its acting as a block.
I really didn't want to ask a question about it, but I am losing time by getting frustrated about this.
<div class="fbox" id="breast">
<span class="title">Breast Procedures</span>
<ul>
<li>Breast Augmentation</li>
<li>Breast Lift</li>
<li>Breast Reduction</li>
<li>Gynecomastia Surgery</li>
<li>Breast Implant</li>
<li>Nipple Surgery</li>
<li>Breast Asymmetry</li>
</ul>
<span class="read">View Descriptions</span>
</div>
<div class="fbox" id="facial">
<span class="title">Facial Procedures</span>
<ul>
<li>Brow Lift</li>
<li>Face Lift</li>
<li>Eyelid Lift</li>
<li>Nose Surgery</li>
<li>Facial Implant</li>
<li>Neck Lift</li>
<li>Earlobe Repair</li>
<li>Ear Reshaping</li>
<li>Chin Implant</li>
<li>Chin Augmentation</li>
</ul>
<span class="read">View Descriptions</span>
</div>
<div class="padding">
<div class="fbox" id="body">
<span class="title">Body Procedures</span>
<ul>
<li>Tummy Tuck</li>
<li>Liposuction</li>
<li>Mommy Makeover</li>
<li>Butt Lift</li>
<li>Body Contouring</li>
<li>Labiaplasty</li>
<li>Brachioplasty</li>
<li>Thigh Lift</li>
<li>Upper Body Lift</li>
</ul>
<span class="read">View Descriptions</span>
</div>
</div>
<div class="fbox" id="surgery">
<span class="title">Non-Surgical Procedures</span>
<ul>
<li>Fat Injection</li>
<li>Latisse</li>
<li>Botox</li>
<li>Dermabrasion</li>
<li>Chemical Peels</li>
</ul>
<span class="read">View Descriptions</span>
</div>
CSS: (Main code at bottom. .fbox, .read, .title)
.controls{
display:none;
}
.col span_6 {
text-color:black;
color:black;
}
.subheader{
text-color:black;
color:black;
}
.callbox{
background-color:white;
border-style:solid;
border-width:1px;
border-color:black;
display:block;
text-align:center;
height:75px;
width:1116.95px;
line-height:75px;
font-size:22px;
font-weight:bold;
}
.toggle h3 a{
color:black;
}
body .toggle > div {
padding: 10px 14px;
border-top: 0px;
border:1px solid #D2691E;
display: none;
background-color: #fff!important;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
-o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
/** .receptionist{
border:1px solid #D2691E;
display:block;
padding:5px;
border-radius:5px;
}
**/
.menu-item{
font-weight:600;
}
.hr{
display: block;
height: 1px;
border: 1px solid #8CAAD2;
margin: 1em 0;
padding: 0;
}
.settingsFront{
height:10px;
}
.settingsMessage{
height:150px;
}
.settingsMessageMain{
height:200px;
}
/** Start here ! **/
.title{
font-size:16px;
margin:0 auto;
text-align:center;
font-weight:600;
width: 100%;
position: absolute;
top: 0;
left: 0;
background-color:white;
background:white;
font-family:Futura;
-webkit-transition: box-shadow 1s ease;
-moz-transition: box-shadow 1s ease;
-o-transition: box-shadow 1s ease;
-ms-transition: box-shadow 1s ease;
transition: box-shadow 1s ease;
-moz-box-shadow: 0px 0px 5px 1px rgb(139, 139, 139);
-webkit-box-shadow: 0px 0px 5px 1px rgb(139, 139, 139);
box-shadow: 0px 0px 5px 1px rgb(139, 139, 139);
}
.main-content ul li{
list-style-type:none;
}
.main-content ul{
margin:0 auto;
}
.fbox{
width: 250px;
height: 300px;
background: rgb(250, 250, 250);
-moz-box-shadow: 0px 0px 5px 1px rgb(139, 139, 139);
-webkit-box-shadow: 0px 0px 5px 1px rgb(139, 139, 139);
box-shadow: 0px 0px 5px 1px rgb(139, 139, 139);
display:inline-block;
vertical-align:top;
text-align:center;
margin:0 auto;
position:relative;
}
.read{
width: 100%;
left: 0;
bottom: 0;
background-color:white;
background:white;
font-size:22px;
height:40px;
line-height:40px;
font-family:Futura;
-webkit-transition: box-shadow 1s ease;
-moz-transition: box-shadow 1s ease;
-o-transition: box-shadow 1s ease;
-ms-transition: box-shadow 1s ease;
transition: box-shadow 1s ease;
-moz-box-shadow: 0px 0px 5px 1px rgb(139, 139, 139);
-webkit-box-shadow: 0px 0px 5px 1px rgb(139, 139, 139);
box-shadow: 0px 0px 5px 1px rgb(139, 139, 139);
}
.read a{
color:#7e99bd;
}
.wpcf7-form-control-wrap{
background:white;
background-color:white;
}
#media (max-width:767px){
.fbox{
width: 200px;
height: 250px;
background: rgb(250, 250, 250);
-moz-box-shadow: 0px 0px 5px 1px rgb(139, 139, 139);
-webkit-box-shadow: 0px 0px 5px 1px rgb(139, 139, 139);
box-shadow: 0px 0px 5px 1px rgb(139, 139, 139);
display:inline-block;
font-size:12px;
}
}
Fiddle
Your third div.fbox is wrapped in a parent div with class .padding which is causing a break in the display: inline-box rule. Remove the div.padding element around the third div.fbox element and your div tags will line up again.
#Travis the fbox is working as inline-block if you want to know more information go through this.
If you want all three boxes inline-block, you will need all three in the same div

Link in position absolute doesn't work

Anyone know why not work me a link when I hover on the picture?
I added a hover effect and link stopped working :/
Anyone know how I can fix this problem?
/*** effect inner-shadow ***/
.image-home-effect {
position: relative;
}
.image-home-effect:before {
content:'';
float:left;
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
z-index:20;
cursor: pointer;
margin-top: -12px;
height: 222px;
}
.image-home-effect:before {
transition: all 1s;
-webkit-transition: all 1s;
-moz-transition:all 1s;
}
.image-home-effect:hover:before {
box-shadow:inset 0px 0px 120px rgba(0, 0, 0, 0.9);
-moz-box-shadow:inset 0px 0px 120px rgba(0, 0, 0, 0.9);
-webkit-box-shadow:inset 0px 0px 120px rgba(0, 0, 0, 0.9)
}
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<div class="content-box">
<h2>Meble biurowe</h2>
<div class="image-home-effect">
<img src="images/meble-biurowe.jpg">
</div>
</div>
</div>
Try putting your anchor tag on the outside of the div with class image-home-effect.
like this:
<a href="http://www.onet.pl/" target="_blank" class="img-inner-shadow">
<div class="image-home-effect">
<img src="images/meble-biurowe.jpg">
</div>
</a>
i am not sure but may be this help you
http://jsfiddle.net/5z4paLgr/4/
HTML
<img src="images/meble-biurowe.jpg">
CSS
.image-home-effect {
position: relative;
}
.image-home-effect:before {
content:'';
float:left;
position:absolute;
top:0;
left:0;
width:500px;
height:500px;
z-index:20;
cursor: pointer;
margin-top: -12px;
height: 222px;
}
.image-home-effect:before {
transition: all 1s;
-webkit-transition: all 1s;
-moz-transition:all 1s;
}
.image-home-effect:hover:before {
box-shadow:inset 0px 0px 120px rgba(0, 0, 0, 0.9);
-moz-box-shadow:inset 0px 0px 120px rgba(0, 0, 0, 0.9);
-webkit-box-shadow:inset 0px 0px 120px rgba(0, 0, 0, 0.9)
}
Wrap the anchor around your div
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<div class="content-box">
<h2>Meble biurowe</h2>
<a href="http://www.onet.pl/" target="_blank" class="img-inner-shadow">
<div class="image-home-effect">
<img src="images/meble-biurowe.jpg">
</div></a>
</div>
</div>

Center a div that contains another div with inline-block

How do i center a main DIV, within which contains another div that has an inline-block.
<div class="newdiv>
<div class="pinterest-hover social-slide"></div>
<div class="instagram-hover social-slide"></div>
<div class="reddit-hover social-slide"></div>
<div class="rss-hover social-slide"></div>
</div>
CSS:
.stumbleupon-hover {
background-image: url('icons/stumbleupon-hover.png');
}
.social-slide {
height: 48px;
width: 48px;
border:3px solid;
/*margin: 10px;*/
display:inline-block;
-webkit-transition: all ease 0.3s;
-moz-transition: all ease 0.3s;
-o-transition: all ease 0.3s;
-ms-transition: all ease 0.3s;
transition: all ease 0.3s;
}
.social-slide:hover {
background-position: 0px -48px;
-moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3)
/*box-shadow: 0px 0px 3px 1px rgba(0,0,0,0.8);*/
}
div.newdiv {
margin: 0 auto 0 auto;
}
Basically I want to center the social icons via newdiv
JSFiddle: http://jsfiddle.net/uWaPy/
Use :
div.new-div {
text-align:center;
}
You had a missing " in the div.new-div.
See updated fiddle.
IE < 8 doesn't like inline-block, there's a hack :
.social-slide {
display:inline-block;
*display:inline;
*zoom:1;
}
.newdiv
{
margin-left: auto;
margin-right: auto;
width:900px;
}
add text-align:center; to div.newdiv
Also you are missing a " in your html.
<div class="newdiv>
should be:
<div class="newdiv">
div.newdiv {
margin: 0 auto;
text-align: center;
width: 1000px;
}
just edit this code. And in your div tag, it should be <div class="newdiv">

Element not displaying next to text HTML/CSS

So this is the code I'm working on:
HTML
<div id="t_welcomesection">
<h1>Hello World!</h1>
<p>Lorem Ipsum.
<div class="morebtn">More >>
</div>
</p>
</div>
<!-- end of welcomesection -->
CSS
.morebtn {
color: #FFF;
background-color: rgba(219,87,5,1);
font-size: 17px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: 0px 9px 0px rgba(219,31,5,1), 0px 9px 25px rgba(0,0,0,.7);
-moz-box-shadow: 0px 9px 0px rgba(219,31,5,1), 0px 9px 25px rgba(0,0,0,.7);
box-shadow: 0px 9px 0px rgba(219,31,5,1), 0px 9px 25px rgba(0,0,0,.7);
width: 100px;
text-align: center;
-webkit-transition: all .1s ease;
-moz-transition: all .1s ease;
-ms-transition: all .1s ease;
-o-transition: all .1s ease;
transition: all .1s ease;
}
.morebtn:active {
color: #FFF;
-webkit-box-shadow: 0px 3px 0px rgba(219,31,5,1), 0px 3px 6px rgba(0,0,0,.9);
-moz-box-shadow: 0px 3px 0px rgba(219,31,5,1), 0px 3px 6px rgba(0,0,0,.9);
box-shadow: 0px 3px 0px rgba(219,31,5,1), 0px 3px 6px rgba(0,0,0,.9);
}
#t_welcomesection {
float: left;
width: 800px;
text-align: justify;
padding: 0px 50px 30px 50px;
}
See working sample here
I want the button to be next to the text. I don't know what's wrong with the code I have. Help is much appreciated. Thanks.
#t_welcomesection p {
display: inline-block;
}
.morebtn {
display: inline-block;
}
You've got div (a block element) inside a p. Just use span instead of div:
Demo
You cannot have div nested inside a p tag as p can only hold inline elements, make your div a span and assign display: inline-block; to the span element
Demo

Content overflows div radius in Chrome

I have a site with strange layout (by my client) and I have developed it fine.
The problem is Chrome (version 22) doesn't work, but in Firefox (version 16) and IE 9 it works.
The problem is in the colRight, there are two divs that don't respect the radius, the content overflows and goes over the colCenter.
How can I fix that?
JSFIDDLE
FIREFOX:
CHROME
HTML:
<div class="colCenter" id="two"></div>
<div class="colRight" id="three">
<div class="first_menu"></div>
<div class="dati_societari"></div>
</div>​
CSS:
.colCenter{
position:absolute;
top:0;
left:18%;
height: 100%;
width: 72%;
background: #ccc;
border-left: 0px solid #333;
border-radius: 280px 0px 0px 280px / 1000px 0px 0px 1000px;
/*border-radius: 0.2px 0px 0px 0.2px;*/
z-index:100;
overflow:hidden !important;
box-shadow:-5px -1px 8px rgba(0,0,0,0.4);
-webkit-box-shadow:-5px -1px 8px rgba(0,0,0,0.4);
-moz-box-shadow: -5px -1px 8px rgba(0,0,0,0.4);
}
.colRight{
position:absolute;
top:0;
right:0;
background:#fff;
height:100%;
width:18%;
z-index:1000;
border-left: 0px solid #333;
/*border-radius: 70px 0px 0px 70px / 250px 0px 0px 250px;*/
border-radius: 280px 0px 0px 280px / 1000px 0px 0px 1000px;
box-shadow:-5px -1px 8px rgba(0,0,0,0.4);
-webkit-box-shadow:-5px -1px 8px rgba(0,0,0,0.4);
-moz-box-shadow: -5px -1px 8px rgba(0,0,0,0.4);
overflow:hidden !important;
}
.first_menu{
height:10%;
width:100%;
background:#714d8f;
position:absolute;
top:0;
left:0;
z-index:2;
}
.dati_societari{
height:8%;
width:100%;
background:#9a9a9a;
position:absolute;
bottom:50px;
left:0;
z-index:2;
text-align:center;
}
.social{
position:absolute;
width:100%;
bottom:5%;
left:20%;
}
.img_social{
opacity:0.7;
transition-property: opacity; /*standard*/
transition-duration: 0.4s;
-webkit-transition-property: opacity; /*Safari e Chrome */
-webkit-transition-duration: 0.4s;
-o-transition-property: opacity; /*Opera*/
-o-transition-duration: 0.4s;
-moz-transition-property: opacity; /*Firefox*/
-moz-transition-duration: 0.4s;
}
This appears to be a Webkit bug...
CSS Border radius not trimming image on Webkit
Bug Reports...
https://bugs.webkit.org/show_bug.cgi?id=30475
http://code.google.com/p/chromium/issues/detail?id=82417