4
I’m building the responsive of a study project,
Codes below:
var slideItem=0;
window.onload =function() {
setInterval(passarSlide, 2000);
var slidewidth =document.getElementById("slideshow").offsetWidth;
var objs =document.getElementsByClassName("slide");
for(var i in objs) {
objs[i].style.width=slidewidth+'px';
}
}
function passarSlide() {
var slidewidth =document.getElementById("slideshow").offsetWidth;
if(slideItem>= 3) {
slideItem=0
} else {
slideItem++;
}
document.getElementsByClassName("slideshow_area")[0].style.marginLeft= "-"+(slidewidth * slideItem)+"px";
}
function mudarSlide(pos) {
slideItem = pos;
var slidewidth =document.getElementById("slideshow").offsetWidth;
document.getElementsByClassName("slideshow_area")[0].style.marginLeft= "-"+(slidewidth * slideItem)+"px";
body {
margin: 0;
padding: 0;
font-family: helvetica;
font-size: 12px;
}
.topo {
height: 30px;
background-color: #303030;
}
.topoint {
width: 100%;
max-width: 1040px;
height: 30px;
margin: auto;
}
.topoleft {
width: 50%;
height: 30px;
float: left;
}
.toporight {
width: 50%;
height: 28px;
float: right;
text-align: right;
margin-top: 2px;
}
.topoleft ul {
margin: 0;
padding: 0;
list-style: none;
}
.topoleft li {
float: left;
height: 30px;
line-height: 30px;
margin-left: 8px;
margin-right: 8px;
}
.topoleft li a {
text-decoration: none;
color: #FFF;
}
.topoleft li .ativo {
color: blue;
}
.topobusca {
width: 110px;
height: 26px;
outline: 0;
}
.toporight a {
float: right;
}
.toporight input {
float: right;
}
.toporight img {
margin-right: 4px;
}
.topo2 {
height: 95px;
}
.topo2int {
width: 100%;
max-width: 1040px;
height: 95px;
margin: auto;
}
.logo {
width: 230px;
height: 65px;
float: left;
margin-top: 30px;
}
.topo2 .banner {
width: 650px;
height: 80px;
float: right;
margin-top: 7px;
background-color: #ff0000;
font-size: 40px;
color: #fff;
line-height: 80px;
text-align: center;
font-family: roboto;
}
.menu {
height: 40px;
background-color: #ff0000;
}
.menuint {
width: 100%;
max-width: 1040px;
height: 40px;
margin: auto;
}
.menu ul {
margin: 0;
padding: 0;
list-style: none;
position: absolute;
}
.menu li {
float: left;
height: 40px;
line-height: 40px;
padding-left: 8px;
padding-right: 8px;
}
.menu li:hover .submenu {
display: block;
}
.menu a {
color: #fff;
text-decoration: none;
}
.submenu {
width: 140px;
position: absolute;
background-color: #ff0000;
display: none;
}
.submenuitem {
width: 140px;
height: 30px;
line-height: 30px;
padding-left: 10px;
}
.submenuitem:hover {
background-color: #ff5555;
width: 130px;
}
.ultimasnoticias {
height: 40px;
}
.ultimasnoticiasint {
width: 100%;
max-width: 1040px;
height: 40px;
margin: auto;
}
.ultnoticiasarea {
height: 28px;
background-color: #fff;
border: 1px solid #ccc;
margin-top: 10px;
border-radius: 2px;
}
.ultnoticiastitulo {
background-color: #ff0000;
color: #fff;
height: 28px;
line-height: 28px;
display: inline-block;
padding-left: 10px;
padding-right: 10px;
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
font-size: 16px;
}
.ultnoticiasnoticia {
color: #000;
height: 28px;
line-height: 28px;
display: inline-block;
padding-left: 10px;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
}
.containerint {
width: 100%;
max-width: 1040px;
margin: auto;
}
.leftside {
width: 750px;
float: left;
}
.rightside {
width: 278px;
min-height: 300px;
float: right;
margin-left: 12px;
}
.widget {
border: 1px solid #ccc;
background-color: #fff;
margin-bottom: 10px;
border-radius: 2px;
}
.widget_titulo {
height: 30px;
line-height: 30px;
background-color: #ddd;
border-bottom: 1px solid #ccc;
padding-left: 5px;
font-size: 14px;
}
.widget_conteudo {
text-align: center;
padding-top: 5px;
padding-bottom: 5px;
}
.noticia_item {
font-size: 14px;
margin: 0px 10px;
padding: 10px 0px;
text-align: left;
border-bottom: 1px solid #ccc;
}
.noticia_item a {
text-decoration: none;
color: #000;
}
.slideshow {
height: 335px;
overflow: hidden;
margin-bottom: 20px;
}
.slideshow_area {
width: 10000px;
height: 335px;
transition: all 1s;
}
.slide {
height: 335px;
float: left;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
.slide img {
height: 335px;
width: 750px;
}
.slideinfo {
position: relative;
top: -70px;
height: 70px;
background-image: url('../images/slideshow_bg.png');
background-size: auto 70px;
z-index: 10000;
}
.slideinfo_titulo {
font-size: 20px;
color: #fff;
padding-top: 20px;
margin-left: 20px;
}
.slideinfo_subtitulo {
font-size: 13px;
margin-left: 20px;
color: #fff;
}
.bolls {
position: absolute;
width: 200px;
height: 15px;
margin-left: 10px;
padding-top: 10px;
}
.boll {
width: 15px;
height: 15px;
float: left;
margin-right: 5px;
cursor: pointer;
background-color: #d0d1cc;
border-radius: 10px;
}
.noticiaarea1 {
width: 420px;
height: 420px;
float: left;
}
.noticiaitem1 {
height: 220px;
}
.noticia_image {
width: 390px;
height: 220px;
float: left;
padding: 3px;
border: 1px solid #ccc;
margin-top: 4px;
margin-left: 15px;
}
.texto_descritivo {
font-size: 30px;
width: 390px;
text-align: left;
margin-left: 15px;
}
.texto_subdescritivo {
color: #ccc;
font-size: 12px;
text-align: left;
margin-left: 15px;
}
.noticiaarea2 {
width: 310px;
height: 420px;
float: right;
}
.clear {
clear: both;
}
.noticiaitem {
text-align: left;
height: 88px;
margin-bottom: 14px;
}
.noticia_img {
width: 80px;
height: 80px;
border: 1px solid #ccc;
padding: 3px;
margin-top: 4px;
float: left;
}
.noticiatitulo {
float: left;
margin-left: 5px;
margin-top: 4px;
font-size: 16px;
width: 216px;
}
.noticiainfo {
float: left;
margin-left: 5px;
margin-top: 4px;
color: #999;
width: 216px;
}
.footer {
position: absolute;
height: 35px;
width: 100%;
left: 0;
background-color: #ff0000;
}
.footerint {
width: 100%;
max-width: 1040px;
height: 35px;
margin: auto;
background-color: #ff0000;
font-size: 20px;
color: #fff;
text-align: center;
line-height: 35px;
font-family: roboto;
}
@media only screen and (max-width:1057px) {
.topoint,
.topo2int,
.menuint,
.ultimasnoticiasint,
.containerint,
.footerint {
max-width: 890px;
}
.leftside {
width: 600px;
}
.slide img {
width: ;
}
.noticiaarea1 {
width: 280px;
}
.noticia_image {
width: 250px;
}
.noticia_image img {
width: 250px;
}
.texto_descritivo {
width: 250px;
font-size: 25px;
}
}
A test tile for this slide Test subtitle for this slide A test tile for this slide Test subtitle for this slide A test tile for this slide Test subtitle for this slide A test tile for this slide Test subtitle for this slide NEWS Some descriptive text that will appear here below this image 1250 Likes 500 comments Some kind of title 500 comments Some kind of title 500 comments Some kind of title 500 comments RECENT NEWS Some descriptive text that will appear here below this image 1250 Likes 500 comments Some kind of title 500 comments Some kind of title 500 comments Some kind of title 500 comments 2018. All rights reserved SOCIAL LATEST NEWS Any news from any site that will appear in this part of the portal to exemplify. Any news from any site that will appear in this part of the portal to exemplify. Any news from any site that will appear in this part of the portal to exemplify. Any news from any site that will appear in this part of the portal to exemplify. Any news from any site that will appear in this part of the portal to exemplify. PUBLICIDADADE FIND US ON FACEBOOK
I did as you said, more when I lower the page to the 1057 px established the site breaks, how to solve this?
– user111919
Stephan, try leaving the class
.leftside {
with the same 600px to make a test.– Sam
It worked, but when I go back to the original screen the images inside slide do not follow and are appearing half of each one and breaks the slide so I need to give an F5 to go back to normal, what? there’s a way to fix it?
– user111919
I updated the part about
@media only screen and (max-width:1057px) {
... it seems to me that the minimum resolution is 600px, so I left some classes with 600px fixed.– Sam
Now it worked just fine, thanks for the help!
– user111919
Hello, I am continuing with the responsiveness of the project, and now I have a problem in my logo and in the navigation div latest news. The logo is getting stuck at the top of the portal, while the navigation menu last news is not adapting the width of the rest of the content, can give me a help?
– user111919
Where can I post the codes so you can take a look?
– user111919
Oops! I’ll talk to you soon, blz?
– Sam
All right, buddy, no problem!
– user111919
Let’s go continue this discussion in chat.
– user111919
I’m in the chat room.....
– Sam
Hey buddy, come on chat I had some more problems.
– user111919