Boxes overlap each other - php

so I got a while loop display the names and some css and jquery to make it so when you hover over one of the boxes made in the while loop it will have a little description telling about that result scroll up. But the problem is all the description boxes are overlapping each other. What am I doing wrong?
Css
.App_display {
border: 2px solid black;
padding:30px;
background:white;
border-radius:25px;
float:left;
width:190px;
height:100px;
margin:10px;
}
.boxTop { position:absolute; z-index:9; top:0; left:0; height:inherit; width:inherit;
overflow:hidden;}
.description { position:absolute; bottom:-50px; height:40px; width:459px; background-color:#000; opacity:.7; font-size:16px; color:#fff; padding:10px; }
Jquery
<script>
$('.App_display').hover(function() {
$(this).find('.description').stop().animate({
bottom: '0px',
})
},
function() {
$(this).find('.description').stop().animate({
bottom: '-50px',
})
});
</script>
Html(This code is generated in a while loop)
<div class="App_display">
<div class="boxTop">
<div class="description"><?php echo $name; ?></div>
</div>
</div>
.App_display {
border: 2px solid black;
padding:30px;
background:white;
border-radius:25px;
float:left;
width:190px;
height:100px;
margin:10px;
}
.boxTop { position:absolute; z-index:9; top:0; left:0; height:inherit; width:inherit;
overflow:hidden;}
.description { position:absolute; bottom:-50px; height:40px; width:459px; background-color:#000; opacity:.7; font-size:16px; color:#fff; padding:10px; }
<div class="App_display">
<div class="boxTop">
<div class="description">Item1</div>
</div>
</div>
<div class="App_display">
<div class="boxTop">
<div class="description">Item2</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
$('.App_display').hover(function() {
$(this).find('.description').stop().animate({
bottom: '0px',
})
},
function() {
$(this).find('.description').stop().animate({
bottom: '-50px',
})
});
</script>

in css when you use position absolute it will set the position of the element relative to the first non static ancestor element, in your case probably the window.
so you need to set the next ancestor to a non static position then it will fix your issue
add to your App_display class this line:
.App_display {
position:relative;
}

Related

Show title tag on hover inside img

Hi I need show a Title tag of img inside img.
Like this example http://jsfiddle.net/51csqs0b/
.image {
position:relative;
width:200px;
height:200px;
}
.image img {
width:100%;
vertical-align:top;
}
.image:after, .image:before {
position:absolute;
opacity:0;
transition: all 0.5s;
-webkit-transition: all 0.5s;
}
.image:after {
content:'\A';
width:100%; height:100%;
top:0; left:0;
background:rgba(0,0,0,0.6);
}
.image:before {
content: attr(data-content);
width:100%;
color:#fff;
z-index:1;
bottom:0;
padding:4px 10px;
text-align:center;
background:red;
box-sizing:border-box;
-moz-box-sizing:border-box;
}
.image:hover:after, .image:hover:before {
opacity:1;
}
<div data-content="Here is a caption" class="image">
<img src="http://i.stack.imgur.com/Sjsbh.jpg" alt="" />
</div>
<hr>
<div data-content="Different caption here..." class="image">
<img src="http://i.stack.imgur.com/Sjsbh.jpg" alt="" />
</div>
But i don't want use a div before img.
<img class="" title="TITLE NEED SHOW ON HOVER" src=""/>
It's possible to show up?
Thanks
This is all thing I can do:
add .image class to a
<a class="image" href="#"><img src="http://i.stack.imgur.com/Sjsbh.jpg" class="" title="TITLE NEED SHOW ON HOVER" src=""/></a>
replace data-content with title in css:
.image:before {
content: attr(title);
width:100%;
color:#fff;
z-index:1;
bottom:0;
padding:4px 10px;
text-align:center;
background:red;
box-sizing:border-box;
-moz-box-sizing:border-box;
}
finally, add this jQuery code:
$("a.image").each(function(){$(this).attr('title',$(this).find("img").attr('title'))});
Run it yourself here:
Here is an easier way. You just use :after pseudoelement on hover.
Pure CSS solution
.img{
display: block;
width:200px;
height:200px;
background: url('http://i.stack.imgur.com/Sjsbh.jpg');
background-size: 200px 200px;
position: relative;
}
.img:hover::after {
content:'This is a description';
position: absolute;
width:100%;
height:20%;
bottom:0; left:0;
background: rgba(255, 255, 255, 0.8);
}
You won't very specific. I hope it will help.
You can also make a tooltip.

div not showing up in firefox

i am developing a web application,I have made some div which is visible in each browser.one of my div is not showing up on firefox.What are the possible reasons.
here is my fiddle
i have given the background-color:black to the div which is not showing up.
css
html, body
{
height:100%;
margin:0;
padding:0;
overflow:hidden;
}
#main_header
{
height:20%;
border-bottom:3px solid grey;
}
#user_info
{
height:40%;
width:auto;
float:right;
text-align:right;
position:relative;
right:3%;
top:42%;
}
#user_info span
{
font-size:1.2em;
font-weight:600;
}
#logo
{
height:60%;
width:25%;
float:left;
background-image:url('../images/ibuildmart_logo.png');
background-repeat:no-repeat;
background-size:100% 100%;
position:relative;
left:5%;
top:20%;
}
#main_wrapper
{
height:75%;
}
#menu_wrap
{
width:10%;
float:left;
height:100%;
background-color:yellow;
}
#content_wrap
{
width:90%%;
height:100%;
float:right ;
}
#content
{
background-color:black;
width:95%;
height:92%;
border-radius:20px;
-moz-border-radius:20px;
margin:2%;
overflow:auto;
}
#main_footer
{
height:5%;
background-color:blue;;
}
html
<div id="main_header">
<?php
include_once('header.php');
?>
</div>
<div id="main_wrapper">
<div id="menu_wrap">
</div>
<div id="content_wrap">
<div id="content">
</div>
</div>
</div>
<div id="main_footer">
<?php
include_once('footer.php');
?>
</div>
Firs thing is the HTML comments are not closed properly. And the main reason is you are using double % in ID content_wrap.
Here is the Demo.
#content_wrap
{
width:90%%; /*you are using double percentage here*/
height:100%;
float:right;
}
You have multiple problems:
http://jsfiddle.net/uZd3u/2/
You closed your HTML comments with --!> which is wrong. It have to be like this: <!-- comment -->
Your content_wrap was float: right;

Why doesn't my HTML table fill up the entire screen when connected to my 42" screen?

I am working on a HTML table that is supposed to be viewed on 42" TV screens. On my computer screen it fills up the entire screen from side to side, however when I connect it to my 46" TV screen via an HDMI cable, the table in the screen doesn't fill up the screen, it is smaller and centralised in the middle of the screen and surrounded with the background colour. I assume this is CSS issue. How do I make the table fill up the entire screen, just like it does on my computer?
Please find attached my laptop screen shot:
and also my TV screen shot:
Find below a copy of the php table:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Create a Parralax Website using Stellar.js</title>
<!-- <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.3.0/build/cssreset/reset-min.css"> -->
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="js/js.js"></script>
<script type="text/javascript" src="js/jquery.stellar.min.js"></script>
<script type="text/javascript" src="js/waypoints.min.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script>
// After 9 seconds click on
$(document).ready(function()
{
setTimeout(function(){ $("#one")[0].click()},8000);
setTimeout(function(){ $("#two")[0].click()},16000);
setTimeout(function(){ $("#three")[0].click()},24000);
setTimeout(function(){ $("#four")[0].click()},32000);
//setTimeout(function(){ $("#one")[0].click()},32000);
setTimeout(function(){window.location.reload();}, 40000)
})
</script>
<?php include ("class/flightScheduleClass.php");
$obj = new FSchedule;
?>
</head>
<body>
<!-- <img class="envatologo" src="images/envatologo.png"> -->
<div class="slide" id="slide1" data-slide="1" data-stellar-background-ratio="0.5">
<div class="wrapper">
<!-- ###################################################### -->
<!-- ############### Arrivals ############################# -->
<img src='../FlightShedule2/images/arrivals.png' alt='Arrivals' style='float:left' align='middle' width='105' height='38'>
<?php
$obj->pushAWeekAHead();
$obj->getArrivals();
?>
</div>
<a class="button" id="one" data-slide="2" title=""></a>
</div><!--End Slide 1-->
<div class="slide" id="slide2" data-slide="2" data-stellar-background-ratio="0.5">
<!-- ###################################################### -->
<!-- ############### Depatures ############################# -->
<img src='../FlightShedule2/images/depature.png' alt='Arrivals' style='float:left' align='middle' width='145' height='38'>
<div class="wrapper">
<?php
echo $obj->getDepatureShedules();
?>
</div>
<!-- <span class="slideno">Slide 2</span> -->
<a class="button" id="two" data-slide="3" title=""></a>
</div><!--End Slide 2-->
<div class="slide" id="slide3" data-slide="3" data-stellar-background-ratio="0.5">
<div class="wrapper">
<!-- ###################################################### -->
<!-- ############### Arrivals ############################# -->
<img src='../FlightShedule2/images/arrivals.png' alt='Arrivals' style='float:left' align='middle' width='105' height='38'>
<?php
// $obj->getShedules();
$obj->getArrivals();
?>
</div>
<!-- <span class="slideno">Slide 3</span> -->
<a class="button" id="three" data-slide="4" title=""></a>
</div><!--End Slide 3-->
<div class="slide" id="slide4" data-slide="4" data-stellar-background-ratio="0">
<!-- <span class="slideno">Slide 4</span> -->
<a class="button" id="four" data-slide="1" title=""></a>
<?php include 'adRotator.html'; ?>
<!-- <span class="parallaxbg">Your Advertisment here!</span> -->
</div><!--End Slide 4-->
</body>
</html>
And the CSS file affecting the table:
#charset "utf-8";
/* CSS Document */
#font-face {
font-family: 'BebasRegular';
src: url('font/BEBAS___-webfont.eot');
src: url('font/BEBAS___-webfont.eot?#iefix') format('embedded-opentype'),
url('font/BEBAS___-webfont.woff') format('woff'),
url('font/BEBAS___-webfont.ttf') format('truetype'),
url('font/BEBAS___-webfont.svg#BebasRegular') format('svg');
font-weight: normal;
font-style: normal;
}
html,body{
font-family: 'BebasRegular';
width:100%;
height:100%;
margin:0;
padding:0;
}
.navigation{
position:fixed;
z-index:1;
top:20px;
}
.navigation li{
color:#333333;
display:block;
padding: 0 10px;
line-height:30px;
margin-bottom:2px;
font-weight:bold;
-webkit-transition: all .2s ease-in-out;
border-bottom:1px solid black;
text-align:left;
width:53px;
}
.navigation li:hover,.active{
font-size:25px;
cursor:pointer;
width:100px!important;
}
.envatologo{
position:fixed;
top:50%;
left:50%;
width:446px;
margin-top:-41px;
margin-left:-223px;
z-index:1;
}
.slide{
background-attachment: fixed;
width:100%;
height:100%;
position: relative;
box-shadow:inset 0px 10px 10px rgba(0,0,0,0.3);
}
.wrapper{
width:1300px;
height:200px;
margin:0 auto;
position:relative;
}
.slideno{
position:absolute;
bottom:0px;
left:0px;
font-size:100px;
font-weight:bold;
color:rgba(255,255,255,0.3);
}
.button{
display:block;
width:50px;
height:50px;
position:absolute;
bottom:0px;
left:50%;
background-color:#333333;
background-image:url(../images/arrow.png);
}
.button2{
display:block;
width:50px;
height:50px;
position:absolute;
bottom:0px;
left:50%;
background-color:#333333;
background-image:url(../images/arrow.png);
}
.button3{
display:block;
width:50px;
height:50px;
position:absolute;
bottom:0px;
left:50%;
background-color:#333333;
background-image:url(../images/arrow.png);
}
.button:hover{
background-color:#494949;
cursor:pointer;
}
/******************************
SLIDE 1
*******************************/
#slide1{
background-color:#080908;
}
/******************************
SLIDE 2
*******************************/
#slide2{
background-color:#080908;
}
#slide2 img:first-child{
padding-left:30px;
}
#slide2 img:nth-child(2){
position:absolute;
top:300px;
left:100px;
}
#slide2 img:nth-child(3){
position:absolute;
top:600px;
left:300px;
}
#slide2 img:nth-child(4){
position:absolute;
top:400px;
left:300px;
}
#slide2 img:nth-child(5){
position:absolute;
top:600px;
right:300px;
}
#slide2 img:nth-child(6){
position:absolute;
top:600px;
right:300px;
}
#slide2 img:nth-child(7){
position:absolute;
top:400px;
right:100px;
}
#slide2 img:nth-child(8){
position:absolute;
top:100px;
right:300px;
}
/******************************
SLIDE 3
*******************************/
#slide3{
background-color:#080908;
}
#slide3 img:first-child{
padding-left:5px;
}
#slide3 img:nth-child(2){
position:absolute;
top:100px;
left:100px;
}
#slide3 img:nth-child(3){
position:absolute;
top:150px;
left:300px;
}
#slide3 img:nth-child(4){
position:absolute;
top:450px;
left:300px;
}
#slide3 img:nth-child(5){
position:absolute;
top:200px;
right:300px;
}
#slide3 img:nth-child(6){
position:absolute;
top:100px;
right:300px;
}
/******************************
SLIDE 4
*******************************/
#slide4{
background-image:url();
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#slide4 .parallaxbg{
position:absolute;
right:40px;
top:40px;
font-size:28px;
color:rgba(51,51,51,0.3);
}
/*********** DATABASE STUFF BELOW ADDED BY VINCENT *******************/
#customers
{
font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
width:100%;
color:#ffffff;
border-collapse:collapse;
}
#customers td, #customers th
{
font-size:1.0em;
border:1px solid #060900;
padding:3px 7px 2px 7px;
background-color:#000000;
}
#customers th
{
font-size:1.5em;
text-align:left;
padding-top:5px;
padding-bottom:4px;
background-color:#050700;
color:#ffff00;
border-bottom: solid 0.15em red;
}
#customers tr.alt td
{
color:#FAF7F7;
background-color:#0B0B61;
}
/*********** Ad Rotator STUFF BELOW ADDED BY VINCENT *******************/
#slideshow-container
{
height:90px;
position:relative;
}
#slideshow-container img
{
position:absolute;
left:0;
top:0;
width:100%;
height:100%;
}
#slideshow
{ position:absolute;
left:0;
top:0;
width:100%;
height:100%;
list-style:none;
}
#slideshow img
{
width:120px;
height:90px;
background-repeat:none;
background-position:top left;
position:absolute;
left:0;
top:0;
}
#slideshow
{
position:absolute;
left:0;
top:0;
width:100%;
height:100%;
}
#slideshow img
{
width:120px;
height:90px;
background-repeat:none;
background-position:top left;
position:absolute;
left:0;
top:0;
} /* adjust this for your images */
Looking forward to you reply.
Isn't that because of width:1300px; in your .wrapper?
Edit:
Sorry, I see you don't use it in your HTML (unless something is missing there).
I would create a new class
.full-width {
width:auto
}
and assign it to your HTML
<div class="wrapper full-width">

Div Height is not automatically extended based on child control

I have created web page
http://jsfiddle.net/KNfrm/embedded/result/
mid div is not extending to the height of left pane and right pane.
mid div has black background color
You need to clear the float after .rightpane, floated elements are removed from the normal html flow. Just add an empty block element after .rightpane with style clear:both
http://jsfiddle.net/KNfrm/1/ - http://jsfiddle.net/KNfrm/1/show
DEMO
CODE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Tile Mode</title>
<style>
body {
margin: auto;
background-color:#fff;
font-family:arial, verdana, helvetica;
font-size:12px;
color:#222;
}
.center{
margin-left:auto;
margin-right:auto;
margin-top:0px;
width:1000px;
height:auto;
display:block;
background-color:#000;
}
.frameDiv {
margin-left:auto;
margin-right:auto;
margin-top:0px;
width:1000px;
height:auto;
display:block;
background-color:#000;
}
.header {
width:auto;
height:150px;
background-color:transparent;
}
.logo {
height:100px;/*background-image:url(./images/header.png);*/
}
.menu {
height:50px;
width:auto;
background-color:#ccc;
}
.menus {
list-style-type: none;
list-style-position:outside;
position: relative;
margin: 0;
padding: 0;
}
.menus li {
display: block;
overflow: hidden;
padding: 0;
cursor: pointer;
float: left;
width: 200px;
height: 50px;
margin-right: 0px;
background-image:url(./images/menu.png);
background-repeat:no-repeat;
}
.menus a {
display:block;
height:50px;
text-indent:-9999px;
outline:none;
}
#menu1 {
background-position:0px 0px;
}
#menu2 {
background-position:-200px 0px;
}
#menu3 {
background-position:-400px 0px;
}
#menu4 {
background-position:-600px 0px;
}
#menu5 {
background-position:-800px 0px;
}
#menu1.active, #menu1:hover {
background-position: 0 bottom;
}
#menu2.active, #menu2:hover {
background-position: -200px bottom;
}
#menu3.active, #menu3:hover {
background-position: -400px bottom;
}
#menu4.active, #menu4:hover {
background-position: -600px bottom;
}
#menu5.active, #menu5:hover {
background-position: -800px bottom;
}
.leftpane {
float:left;
width:750px;
height:auto;
display:block;
background-color:transparent;
}
.rightpane {
float:right;
width:250px;
height:auto;
background-color:transparent;
}
.content {
width:auto;
background-color:transparent;
display:block;
border-color:#666;
border-style:solid;
border-width:5px;
}
.footer {
margin:0px;
width:auto;
height:100px;
background-color:#461015;
display:block;
text-align:center;
overflow:hidden;
}
.footer p {
display:inline;
}
.footer p a:link {
color: #fff;
text-decoration:none;
}
.footer p a:visited {
color: #fff;
text-decoration:none;
}
.footer p a:hover {
color: #fff;
text-decoration:none;
}
.footer p a:active {
color: #fff;
text-decoration:none;
}
.quote {
margin-left:35px;
margin-top:20px;
margin-bottom:20px;
margin-right:35px;
width:180px;
height:40px;
display:block;
}
.facebook {
margin-left:35px;
margin-top:20px;
margin-bottom:20px;
margin-right:35px;
width:180px;
height:40px;
display:block;
background-image:url(images/facebook.png);
background-repeat:no-repeat;
}
.linkedin {
margin-left:35px;
margin-top:20px;
margin-bottom:20px;
margin-right:35px;
width:180px;
height:40px;
display:block;
background-image:url(images/linkedin.png);
background-repeat:no-repeat;
}
.twitter {
margin-left:35px;
margin-top:20px;
margin-bottom:20px;
margin-right:35px;
width:180px;
height:40px;
display:block;
background-image:url(images/twitter.png);
background-repeat:no-repeat;
}
.hl {
border: 2px;
width: 80%;
border-color:#999;
}
ul#ticker {
width: 200px;
height: 200px;
overflow: hidden;
margin:auto;
list-style-type:none;
padding:0px;
font-family:Calibri, Arial, Tahoma;
font-style:normal;
}
ul#ticker li {
margin:0px;
padding:0px;
width: 200px;
height: 130px;
white-space:normal;
overflow:none;
text-align:justify;
}
ul#ticker li a:link {
color: #fff;
text-decoration:none;
}
ul#ticker li a:visited {
color: #fff;
text-decoration:none;
}
ul#ticker li a:hover {
color: #fff;
text-decoration:none;
}
ul#ticker li a:active {
color: #fff;
text-decoration:none;
}
ul#ticker li span {
display: block;
color: #06C;
text-align:center;
}
</style>
<script type="text/javascript" src="js/jquery-1.4.min.js"></script>
</script>
<script type="text/javascript">
$(function()
{
var ticker = function()
{
setTimeout(function(){
$('#ticker li:first').animate( {marginTop: '-120px'}, 800, function()
{
$(this).detach().appendTo('ul#ticker').removeAttr('style');
});
ticker();
}, 4000);
};
ticker();
});
</script>
<body>
<div class="center">
<div class="frameDiv">
<div class="header">
<div class="logo"> </div>
<div class="menu">
<ul class="menus">
<li id="menu1">Home</li>
<li id="menu2">About us</li>
<li id="menu3">Services</li>
<li id="menu4">Gallery</li>
<li id="menu5">Contact</li>
</ul>
</div>
</div>
<div class="mid">
<div class="leftpane">
<div class="image" style="margin:5px; margin-right:0px; display:block;">
<img src="http://www.grnyrenovation.com/images/nycpremier.jpg"; style="overflow:hidden; width:745px" />
</div>
<div class="content"></div>
<div class="footer"> <br/>
<hr style="height:2px; border:1px;" noshade="noshade"/>
<p>Home |</p>
<p>About us |</p>
<p>Services |</p>
<p>Gallery |</p>
<p>Contact</p>
<hr style="height:2px; border:1px; width:70%" noshade="noshade"/>
<p style="margin:8px">&#169 Tile</p>
</div>
</div>
<div class="rightpane">
<div style="clear:both;">
<div class="quote"> </div>
<div class="facebook"> </div>
<div class="linkedin"> </div>
<div class="twitter"> </div>
<hr/ class="hl" style="height:2px; border:1px;" noshade="noshade">
<div class="testimonial">
<div style="color:#FFF; font-weight:bold; font-size:large; font-family:'MS Serif', 'New York', serif; text-align:center;">
<h3>Testimonials</h3>
</div>
<div class="tickerclass">
<ul id="ticker">
<li> <span>Title 1</span> Welcome to Monday, to cancel reply. Tuesday, before that I employed a odioeros's more, but my following you to use the. </li>
<li> <span>Title 2</span> Welcome to Monday, to cancel reply. Tuesday, before that I employed a odioeros's more, but my following you to use the </li>
<li> <span>Title 3</span> Welcome to Monday, to cancel reply. Tuesday, before that I employed a odioeros's more, but my following you to use the </li>
<li> <span>Title 4</span> Welcome to Monday, to cancel reply. Tuesday, before that I employed a odioeros's more, but my following you to use the </li>
<li> <span>Title 5</span> Welcome to Monday, to cancel reply. Tuesday, before that I employed a odioeros's more, but my following you to use the </li>
</ul>
</div>
</div>
<br/>
<hr class="hl" style="height:2px; border:1px;" noshade="noshade"/>
<div class="acceridation" style="text-align:center; height:60px;">
<img style="margin:auto;overflow:hidden;width:80px;height:50px;" align="middle" src="http://www.grnyrenovation.com/images/nkba_170x90.jpg" />
<img style="margin:auto;overflow:hidden;width:80px;height:50px;" align="middle" src="http://www.grnyrenovation.com/images/sm_EPA-Lead-Safe-Certified.png"/>
</div>
</div>
</div>
<div style="clear:both"></div>
</div>
</div>
</div>
</div>
</body>
</html>
try this to add in your code to the centre div
.center{ overflow:auto;}

Why doesn't this jQuery slideshow work properly?

I have inserted jquery slide show in to my newly created real estate web site.
My real estate web site runs on 'Openrealty' platform which is php.
Here is a part of my Original jquery code.
if(!repeat)
$this.parent()
.find('li:nth-child('+current+') a')
.stop(true,true)
.animate({'marginRight':'-20px'},300,function(){
$(this).animate({'opacity':'0.7'},700);
});
When I look at where the error comes from through 'Firebug', it shows as follows.
if(!repeat)
$this.parent()
.find('li:nth-child('+current+') a')
.stop(true,true)
.animate(,300,function(){
$(this).animate(,700);
});
Here you can clearly see that some parts of the original code does not renders by the browser. Such as {'marginRight':'-20px'}
As shown by firebug the error begins from " .animate(,300,function(){ " onwards.
I need to find a solution why this Jquery not works in my web site.
Source of this Jquery slide show : http://tympanus.net/codrops/2010/04/28/pretty-simple-content-slider-with-jquery-and-css3/
Any feedback is highly welcomed...
Thanks for the first 2 answers and request.
Yes I removed all (') marks within all styling as per the answers.
But still the error occurs as same above...
Total Jquery script have three parts.
1. Link to http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
2. Link to outside JS file called 'jquery.easing.1.3.js'
3. Inline script
Following is the inline jquery:
<script type="text/javascript">
$(function() {
var current = 1;
var iterate = function(){
var i = parseInt(current+1);
var lis = $('#rotmenu').children('li').size();
if(i>lis) i = 1;
display($('#rotmenu li:nth-child('+i+')'));
}
display($('#rotmenu li:first'));
var slidetime = setInterval(iterate,3000);
$('#rotmenu li').bind('click',function(e){
clearTimeout(slidetime);
display($(this));
e.preventDefault();
});
function display(elem){
var $this = elem;
var repeat = false;
if(current == parseInt($this.index() + 1))
repeat = true;
/* slide in the current one */
if(!repeat)
$this.parent()
.find('li:nth-child('+current+') a')
.stop(true,true)
.animate({marginRight:-20px},300,function(){
$(this).animate({opacity:0.7},700);
});
current = parseInt($this.index() + 1);
var elem = $('a',$this);
elem.stop(true,true).animate({marginRight:0px,opacity:1.0},300);
var info_elem = elem.next();
$('#rot1 .heading').animate({left:-420px}, 500,'easeOutCirc',function(){
$('h1',$(this)).html(info_elem.find('.info_heading').html());
$(this).animate({left:0px},400,'easeInOutQuad');
});
$('#rot1 .description').animate({bottom:-270px},500,'easeOutCirc',function(){
$('p',$(this)).html(info_elem.find('.info_description').html());
$(this).animate({bottom:0px},400,'easeInOutQuad');
})
$('#rot1').prepend(
$('<img/>',{
style : 'opacity:0',
className : 'bg'
}).load(
function(){
$(this).animate({opacity:1},600);
$('#rot1 img:first').next().animate({opacity:0},700,function(){
$(this).remove();
});
}
).attr('src','slide-images/'+info_elem.find('.info_image').html()).attr('width','950').attr('height','300')
);
}
});
</script>
And following is the html part which shows the slide show.
<div id="sliderbox">
<div class="rotator">
<ul id="rotmenu">
<li>
Luxury Life
<div style="display:none;">
<div class="info_image">1.jpg</div>
<div class="info_heading">Best Homes for you</div>
<div class="info_description">
This is description...
Read more
</div>
</div>
</li>
<li>
Smiling Faces
<div style="display:none;">
<div class="info_image">2.jpg</div>
<div class="info_heading">Do at our best</div>
<div class="info_description">
This is description...
Read more
</div>
</div>
</li>
<li>
Tradition
<div style="display:none;">
<div class="info_image">3.jpg</div>
<div class="info_heading">We goes with tradition</div>
<div class="info_description">
This is description...
Read more
</div>
</div>
</li>
<li>
Lands for sale
<div style="display:none;">
<div class="info_image">4.jpg</div>
<div class="info_heading">A best place to live in Kandy</div>
<div class="info_description">
This is description...
Read more
</div>
</div>
</li>
<li>
True Nature
<div style="display:none;">
<div class="info_image">5.jpg</div>
<div class="info_heading">Brings you beauty in nature</div>
<div class="info_description">
This is description...
Read more
</div>
</div>
</li>
</ul>
<div id="rot1">
<img src="" width="950" height="300" class="bg" alt=""/>
<div class="heading">
<h1></h1>
</div>
<div class="description">
<p></p>
</div>
</div>
</div>
</div>
and following is the CSS:
.rotator{
background-color:#222;
width:950px;
height:300px;
margin:0px auto;
position:relative;
/*font-family:'Myriad Pro',Arial,Helvetica,sans-serif;*/
font-family:Helvetica,sans-serif;
color:#fff;
text-transform:uppercase;
/* letter-spacing:-1px; */
letter-spacing:1px;
border:3px solid #f0f0f0;
overflow:hidden;
-moz-box-shadow:0px 0px 10px #222;
-webkit-box-shadow:0px 0px 10px #222;
box-shadow:0px 0px 10px #222;
}
img.bg{
position:absolute;
top:0px;
left:0px;
}
.rotator ul{
list-style:none;
position:absolute;
right:0px;
top:0px;
margin-top:6px;
z-index:999999;
}
.rotator ul li{
display:block;
float:left;
clear:both;
width:260px;
}
.rotator ul li a{
width:230px;
float:right;
clear:both;
padding-left:10px;
text-decoration:none;
display:block;
height:30px;
line-height:30px;
background-color:#222;
margin:1px -20px 1px 0px;
/*opacity:0.7;*/
color:#f0f0f0;
font-size:12px;
border:1px solid #000;
border-right:none;
outline:none;
/*
text-shadow:-1px 1px 1px #000;
*/
-moz-border-radius:10px 0px 0px 5px;
-webkit-border-top-left-radius:10px;
-webkit-border-bottom-left-radius:10px;
border-top-left-radius:10px;
border-bottom-left-radius:10px;
}
/* .rotator ul li a:hover{
text-shadow:0px 0px 2px #fff;
}
*/
.rotator .heading{
position:absolute;
top:0px;
left:0px;
width:500px;
}
.rotator .heading h1{
text-shadow:-1px 1px 1px #555;
font-weight:normal;
font-size:36px;
padding:20px;
}
.rotator .description{
width:300px;
height:15px;
position:absolute;
bottom:0px;
left:0px;
padding:5px;
background-color:#222;
-moz-border-radius:0px 10px 0px 0px;
-webkit-border-top-right-radius:10px;
border-top-right-radius:10px;
/*opacity:0.7;*/
border-top:1px solid #000;
border-right:1px solid #000;
}
.rotator .description p{
/*text-shadow:-1px 1px 1px #000;*/
text-transform:none;
letter-spacing:normal;
line-height:10px;
font-family:Helvetica,sans-serif;
font-size:13px;
}
a.more{
color:orange;
text-decoration:none;
text-transform:uppercase;
font-size:10px;
}
a.more:hover{
color:#fff;
}
I have analysed every of these scripts but couldn't identified any issues...
Please tell me how I can solve this.
Try this in you original code.
if(!repeat)
$this.parent()
.find('li:nth-child('+current+') a')
.stop(true,true)
.animate({marginRight:-20},300,function(){
$(this).animate({opacity:0.7},700);
});
Your CSS properties for the animate() function seem wrong.
Experiment without the ' (single quote characters)
if(!repeat)
$this.parent()
.find('li:nth-child('+current+') a')
.stop(true,true)
.animate({marginRight:'-20px'},300,function(){
$(this).animate({opacity:0.7},700);
});
As in the animate() examples from the jquery webpage

Categories