Problem with body and background tag-Attachment: Fixed;

Asked

Viewed 90 times

1

@import url('https://fonts.googleapis.com/css?family=Paytone+One');

html,body {
    height: 100%; /* é necessário definir o height 100% no html, body ou qualquer elemento que estiver entre o body e o .container */
    padding: 0;
    margin: 0;
}

body {
    background: url(https://images5.alphacoders.com/568/568653.jpg); 
    background-position: center;
    background-repeat: no-repeat; 
	background-attachment: fixed;
   display: -webkit-flex;
   display: flex;
   -webkit-flex-direction: column;
   flex-direction: column;
   width: 100%;
   height: 100%;
}


body > main {
    flex: 1; /*ocupa todo espaço menos a altura do footer */
	
}

body > footer {
    min-height: 100px;
    background: #0c0c0c;
    color: #fff;
}

#content h1{
text-align:center;
text-shadow: 2px 1px 3px #000;
	
}

h1{
	color: #00C3FF;
	font-family: 'Paytone One', sans-serif;
	font-weight:400;
	font-size:5em;
}

hr{
	border-color: #FFFFFF;
	margin-top: -50px;
	width:600px;

}
::-webkit-scrollbar { 
    display: none; 
}

#slide-show {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  width: 500vw;
  min-width: 100vw !important;
}

.slide-text {
  font-size: 20px;
  color: #fff;
  text-align:center;
}


.slide-text h2 {
  font-family: 'Paytone One', sans-serif;
  font-weight: 400;
  font-size: 80px;
  text-align: center;
  color: #00C3FF;
	text-shadow: 2px 1px 3px #000;
}

.slidex {
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
  z-index: -1;
  color:#000;
}

.activx {
  opacity: 1;
}

.slideshow-nav {

  width: 100vw;
  min-width: 100vw !important;
  font-size: 30px;
  background: transparent;  
}

.bg1, .bg2, .bg3, .bg4 {
  background-repeat: no-repeat !important;
  background-attachment: scroll !important;
  background-position: center center !important;
  height: auto;
  min-height: 100vh;
  overflow: hidden;
  width: 100vw;
  min-width: 100vw !important;
  position: absolute;
  top:0;
  left:0;
}



.slider-center {
  position: absolute;
  height:15%;
  width: 50%;
  left: 50%;
  top: 20%;
  background-color: transparent;
  transform: translate(-50%, -50%);
  -webkit-transform: translate(-50%, -50%);
  -moz-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  text-align: left;
  letter-spacing: 2px;
}

.nav-link {
  transition: all 0.4s;
  padding: 15px;
  color:#fff;
  opacity: 0.2;
  font-size: 40px;  
}
.nav-link:hover {
  color: #999;
  font-size: 80px;
  opacity: 0.8;
}

	
<html>
    <head>
	<meta charset="utf-8">
    <title>Documento sem título</title>
	<link rel="stylesheet" type="text/css" href="css.css" />
    </head>
    <body>
	
<header>
	
	
	
<section id="slide-show">

      <div class="slidex activx">
        <div class="bg1">
          <div class="slider-center">
            <div class="slide-text"><h2>PRAZO GARANTIDO </h2></div>
          </div>
        </div>
      </div>
  
      <div class="slidex">
         <div class="bg2">
           <div class="slider-center">
              <div class="slide-text"><h2>MD10 DE R$:79,00</h2></div>
           </div>
         </div>
      </div>
  
      <div class="slidex">
           <div class="bg3">
             <div class="slider-center">
                <div class="slide-text"><h2>SEGURANÇA</h2></div>
             </div>
           </div>
     </div>

       <div class="slidex">
           <div class="bg4">
             <div class="slider-center">
                <div class="slide-text"><h2>SEGURANÇA2</h2></div>
             </div>
           </div>
     </div>
       <div class="slidex">
           <div class="bg5">
             <div class="slider-center">
                <div class="slide-text"><h2>SEGURANÇA3</h2></div>
             </div>
           </div>
     </div>

</div>
        </section>
</header>

    <main>
		   <section class="faq">
		<div class="bdfaq">
        <div class="row">
                    <h2>FAQ</h2>
                    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam eget ligula eu lectus lobortis condimentum. Aliquam nonummy auctor massa. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla at risus. Quisque purus magna, auctor et, sagittis ac, posuere eu, lectus. Nam mattis, felis ut adipiscing.</p>
        <div class="faqq">
        <a href="faq.html">
        <img src="images/faqq.png"alt="faq">
            </a>
        </div> 
        </div>
			</div>

			
			
			<section id="colap">
			
			</section>
			
			
</section>

		<section class="services">
			
        <div class="fundoserv">
			
					<h1>Secure Job</h1>
			<h2>Services</h2>
	<article>
    <dl id="ud_accordion">
      <dt>VITORIAS</dt>
      <dd>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonu</dd>
      <dt>MELHOR DE 10 (MD10)</dt>
      <dd>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonu</dd>
          <dt>ELO BOOSTING</dt>
      <dd>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonu</dd>
      <dt>DUO BOOSTING</dt>
      <dd>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonu</dd>
          <dt>ELO BOOSTING (PREMIUM)</dt>
      <dd>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonu</dd>
      <dt>SECURE BOOSTING(EXCLUSIVE)</dt>
      <dd>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonu</dd>
    </dl>
</article>
 <img src="img/logo.png"alt="faq">
        </div>
	</section>	

	
		
			<div id="_opcoes_main">
   <form action="teste.php" id="_form" onsubmit="return valEmail()" method="post">
      <input type="hidden" id="_valortt" name="_valortt" />
      <div class="_opcoes_div">
         <em>1.</em> <strong>Selecione a Liga e Divisão atual</strong>
         <br />
         <img src="imagem.png" />
         <br />
         <p>Liga</p>
         <select name="lig_atu" id="lig_atu">
            <option value="bronze">Bronze</option>
            <option value="prata">Prata</option>
            <option value="ouro">Ouro</option>
            <option value="platina">Platina</option>
            <option value="diamante">Diamante</option>
         </select>
         <br />
         <p>Divisão</p>
         <select name="div_atu" id="div_atu">
            <option value="v">V</option>
            <option value="iv">IV</option>
            <option value="iii">III</option>
            <option value="ii">II</option>
            <option value="i">I</option>
         </select>
      </div>
      <div class="_opcoes_div">
         <em>2.</em> <strong>Selecione a Liga e Divisão desejada</strong>
         <br />
         <img src="imagem.png" />
         <br />
         <p>Liga</p>
         <select name="lig_des" id="lig_des">
            <option value="bronze">Bronze</option>
            <option value="prata">Prata</option>
            <option value="ouro">Ouro</option>
            <option value="platina">Platina</option>
            <option value="diamante">Diamante</option>
         </select>
         <br />
         <p>Divisão</p>
         <select name="div_des" id="div_des">
            <option value="v">V</option>
            <option value="iv">IV</option>
            <option value="iii">III</option>
            <option value="ii">II</option>
            <option value="i">I</option>
         </select>
      </div>
      <div class="_opcoes_div">
         <em>3.</em> <strong>Selecione a Fila desejada</strong>
         <br />
         <img src="imagem.png" />
         <br />
         <p>Fila</p>
         <select name="_fila" id="_fila">
            <option value="solo/duo">Solo/Duo</option>
            <option value="flex">Flex</option>
         </select>
      </div>
      <br clear="all" />
      <div id="_botao">
         <div id="_errmsg" style="display: none;">Erro</div>
         <div id="_botao_email" style="display: none;">
            <label>
               <strong>E-mail</strong>
               <br />
               <input onkeyup="$('#_botao #_botao_email label strong').html('E-mail').css('color','#444')" required="required" id="_email" name="_email" type="email" placeholder="Insira seu e-mail" />
            </label>
            <br />
            <button type="submit" id="_botao_valor">
               <div>
                  R$ 0,00
               </div>
               <div>
                  ADQUIRIR
               </div>
            </button>
         </div>
      </div>
   </form>
</div>
		

    </main>

    <footer class="mainfooter">
       <div class="footer-inner">
            conteudo do footer
       </div>
    </footer>

		
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
		$(document).ready(function(){
  var $prev = $('.previousx');
  var $next = $('.nextx');
  var mode = "auto";
  $prev.on({
    click: function(e){
      e.preventDefault();
      mode = "manual";
      showPreviousImage();
    }
  });
  $next.on({
    click: function(e){
      e.preventDefault();
      mode = "manual";
      showNextImage();
      
    }
  });
  
  setInterval(function(){
    if(mode==="auto"){
      showNextImage();
    }
  },5000);
  
  function showNextImage(){
      var $actEl = $('.activx');
      var $nextEl = $actEl.next('.slidex');
      if($nextEl.length){
        $actEl.removeClass('activx');
        $nextEl.addClass('activx');
      }else{
        $actEl.removeClass('activx');
        $('.slidex:first-child').addClass('activx');
      }
  }
  
  function showPreviousImage(){
      var $actEl = $('.activx');
      var $prevEl = $actEl.prev('.slidex');
      if($prevEl.length){
        $actEl.removeClass('activx');
        $prevEl.addClass('activx');
      }else{
        $actEl.removeClass('activx');
        $('.slidex.last').addClass('activx');
      }
  }
});
		</script>	
	</body>
	
</html>

Well I wanted that part of the header not be with this Attachment Fixed of the body, I tried anyway and I could not .

  • I don’t know what you mean a parte do head não ficasse com esse attachment fixed

  • type I didn’t want to leave the body background-Attachment:Fixed in the < header part>

  • Do you want BG to roll with the page? How do you want Header to behave?

  • Type bg is already rolling along with the quiet page, but I wanted q part of the <header> not to roll, because I would go for a slide and it stopped would be better.

  • I wanted q the background not to just roll in the <header> Nav bar part etc .

  • https://elojobmax.com.br/ an example is this slide text / other things from the header of this site .

  • If you put <header style="position: fixed; "> you will see that it will stay fixed. But this Script that keeps changing the text is interfering with something. Have you noticed that there is no scrollbar on the site? It looks like it creates an element over the viewport... From a survey on Parallax, this is the effect they are using on elojobmax.com.br !!

  • @hugocsl so they are using onepage only at index, pq the other pages load is not that?

Show 3 more comments

1 answer

1


Felipe maybe that’s not the answer to what you need. But by the talk in the commentary and the site you showed as reference I think you’re looking to make a Parallax with the Background check?

Take a look if that’s what you need.

@import url(https://fonts.googleapis.com/css?family=Oswald:300,400,700);
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900,200italic,300italic,400italic,600italic,700italic,900italic);

/* Override UGG site */
#main {width: 100%; padding:0;}
.content-asset p {margin:0 auto;}
.breadcrumb {display:none;}

/* Helpers */
/**************************/
.margin-top-10 {padding-top:10px;}
.margin-bot-10 {padding-bottom:10px;}

/* Typography */
/**************************/
#parallax-world-of-ugg h1 {font-family:'Oswald', sans-serif; font-size:24px; font-weight:400; text-transform: uppercase; color:black; padding:0; margin:0;}
#parallax-world-of-ugg h2 {font-family:'Oswald', sans-serif; font-size:70px; letter-spacing:10px; text-align:center; color:white; font-weight:400; text-transform:uppercase; z-index:10; opacity:.9;}
#parallax-world-of-ugg h3 {font-family:'Oswald', sans-serif; font-size:14px; line-height:0; font-weight:400; letter-spacing:8px; text-transform: uppercase; color:black;}
#parallax-world-of-ugg p {font-family:'Source Sans Pro', sans-serif; font-weight:400; font-size:14px; line-height:24px;}
.first-character {font-weight:400; float: left; font-size: 84px; line-height: 64px; padding-top: 4px; padding-right: 8px; padding-left: 3px; font-family: 'Source Sans Pro', sans-serif;}

.sc {color: #3b8595;}
.ny {color: #3d3c3a;}
.atw {color: #c48660;}

/* Section - Title */
/**************************/
#parallax-world-of-ugg .title {background: white; padding: 60px; margin:0 auto; text-align:center;}
#parallax-world-of-ugg .title h1 {font-size:35px; letter-spacing:8px;}

/* Section - Block */
/**************************/
#parallax-world-of-ugg .block {background: white; padding: 60px; width:820px; margin:0 auto; text-align:justify;}
#parallax-world-of-ugg .block-gray {background: #f2f2f2;padding: 60px;}
#parallax-world-of-ugg .section-overlay-mask {position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: black; opacity: 0.70;}

/* Section - Parallax */
/**************************/
#parallax-world-of-ugg .parallax-one {padding-top: 200px; padding-bottom: 200px; overflow: hidden; position: relative; width: 100%; background-image: url(https://images.unsplash.com/photo-1415018255745-0ec3f7aee47b?dpr=1&auto=format&fit=crop&w=1500&h=938&q=80&cs=tinysrgb&crop=); background-attachment: fixed; background-size: cover; -moz-background-size: cover; -webkit-background-size: cover; background-repeat: no-repeat; background-position: top center;}
#parallax-world-of-ugg .parallax-two {padding-top: 200px; padding-bottom: 200px; overflow: hidden; position: relative; width: 100%; background-image: url(https://images.unsplash.com/photo-1432163230927-a32e4fd5a326?dpr=1&auto=format&fit=crop&w=1500&h=1000&q=80&cs=tinysrgb&crop=); background-attachment: fixed; background-size: cover; -moz-background-size: cover; -webkit-background-size: cover; background-repeat: no-repeat; background-position: center center;}
#parallax-world-of-ugg .parallax-three {padding-top: 200px; padding-bottom: 200px; overflow: hidden; position: relative; width: 100%; background-image: url(https://images.unsplash.com/photo-1440688807730-73e4e2169fb8?dpr=1&auto=format&fit=crop&w=1500&h=1001&q=80&cs=tinysrgb&crop=); background-attachment: fixed; background-size: cover; -moz-background-size: cover; -webkit-background-size: cover; background-repeat: no-repeat; background-position: center center;}

/* Extras */
/**************************/
#parallax-world-of-ugg .line-break {border-bottom:1px solid black; width: 150px; margin:0 auto;}

/* Media Queries */
/**************************/
@media screen and (max-width: 959px) and (min-width: 768px) {
  #parallax-world-of-ugg .block {padding: 40px; width:620px;}
}
@media screen and (max-width: 767px) {
  #parallax-world-of-ugg .block {padding: 30px; width:420px;}
  #parallax-world-of-ugg h2 {font-size:30px;}
  #parallax-world-of-ugg .block {padding: 30px;}
  #parallax-world-of-ugg .parallax-one, #parallax-world-of-ugg .parallax-two, #parallax-world-of-ugg .parallax-three {padding-top:100px; padding-bottom:100px;}
}
@media screen and (max-width: 479px) {
  #parallax-world-of-ugg .block {padding: 30px 15px; width:290px;}
}
<div id="parallax-world-of-ugg">
  
<section>
  <div class="title">
    <h3>Let's do some</h3>
    <h1>PARALLAX</h1>
  </div>
</section>

<section>
    <div class="parallax-one">
      <h2>SOUTHERN CALIFORNIA</h2>
    </div>
</section>

<section>
  <div class="block">
    <p><span class="first-character sc">I</span>n 1978, Brian Smith landed in Southern California with a bag of sheepskin boots and hope. He fell in love with the sheepskin experience and was convinced the world would one day share this love. The beaches of Southern California had long been an epicenter of a relaxed, casual lifestyle, a lifestyle that Brian felt was a perfect fit for his brand. So he founded the UGG brand, began selling his sheepskin boots and they were an immediate sensation. By the mid 1980's, the UGG brand became a symbol of relaxed southern California culture, gaining momentum through surf shops and other shops up and down the coast of California, from San Diego to Santa Cruz. UGG boots reached beyond the beach, popping up in big cities and small towns all over, and in every level of society. Girls wore their surfer boyfriend's pair of UGG boots like a letterman jacket. When winter came along, UGG boots were in ski shops and were seen in lodges from Mammoth to Aspen.</p>
    <p class="line-break margin-top-10"></p>
    <p class="margin-top-10">The UGG brand began to symbolize those who embraced sport and a relaxed, active lifestyle. More than that, an emotional connection and a true feeling of love began to grow for UGG boots, just as Brian had envisioned. People didn't just like wearing UGG boots, they fell in love with them and literally could not take them off. By the end of the 90's, celebrities and those in the fashion world took notice of the UGG brand. A cultural shift occurred as well - people were embracing, and feeling empowered, by living a more casual lifestyle and UGG became one of the symbols of this lifestyle. By 2000, a love that began on the beaches had become an icon of casual style. It was at this time that the love for UGG grew in the east, over the Rockies and in Chicago. In 2000, UGG Sheepskin boots were first featured on Oprah's Favorite Things® and Oprah emphatically declared that she "LOOOOOVES her UGG boots." From that point on, the world began to notice.</p>
  </div>
</section>

<section>
  <div class="parallax-two">
    <h2>NEW YORK</h2>
  </div>
</section>

<section>
  <div class="block">
    <p><span class="first-character ny">B</span>reaking into the New York fashion world is no easy task. But by the early 2000's, UGG Australia began to take it by storm. The evolution of UGG from a brand that made sheepskin boots, slippers, clogs and sandals for an active, outdoor lifestyle to a brand that was now being touted as a symbol of a stylish, casual and luxurious lifestyle was swift. Much of this was due to a brand repositioning effort that transformed UGG into a high-end luxury footwear maker. As a fashion brand, UGG advertisements now graced the pages of Vogue Magazine as well as other fashion books. In the mid 2000's, the desire for premium casual fashion was popping up all over the world and UGG was now perfectly aligned with this movement.</p>
    <p class="line-break margin-top-10"></p>
    <p class="margin-top-10">Fueled by celebrities from coast to coast wearing UGG boots and slippers on their downtime, an entirely new era of fashion was carved out. As a result, the desire and love for UGG increased as people wanted to go deeper into this relaxed UGG experience. UGG began offering numerous color and style variations on their sheepskin boots and slippers. Cold weather boots for women and men and leather casuals were added with great success. What started as a niche item, UGG sheepskin boots were now a must-have staple in everyone's wardrobe. More UGG collections followed, showcasing everything from knit boots to sneakers to wedges, all the while maintaining that luxurious feel UGG is known for all over the world. UGG products were now seen on runways and in fashion shoots from coast to coast. Before long, the love spread even further.</p>
  </div>
</section>

<section>
  <div class="parallax-three">
    <h2>ENCHANTED FOREST</h2>
  </div>
</section>

<section>
  <div class="block">
    <p><span class="first-character atw">W</span>hen the New York fashion community notices your brand, the world soon follows. The widespread love for UGG extended to Europe in the mid-2000's along with the stylish casual movement and demand for premium casual fashion. UGG boots and shoes were now seen walking the streets of London, Paris and Amsterdam with regularity. To meet the rising demand from new fans, UGG opened flagship stores in the UK and an additional location in Moscow. As the love spread farther East, concept stores were opened in Beijing, Shanghai and Tokyo. UGG Australia is now an international brand that is loved by all. This love is a result of a magical combination of the amazing functional benefits of sheepskin and the heightened emotional feeling you get when you slip them on your feet. In short, you just feel better all over when you wear UGG boots, slippers, and shoes.</p>
    <p class="line-break margin-top-10"></p>
    <p class="margin-top-10">In 2011, UGG will go back to its roots and focus on bringing the active men that brought the brand to life back with new styles allowing them to love the brand again as well. Partnering with Super Bowl champion and NFL MVP Tom Brady, UGG will invite even more men to feel the love the rest of the world knows so well. UGG will also step into the world of high fashion with UGG Collection. The UGG Collection fuses the timeless craft of Italian shoemaking with the reliable magic of sheepskin, bringing the luxurious feel of UGG to high end fashion. As the love for UGG continues to spread across the world, we have continued to offer new and unexpected ways to experience the brand. The UGG journey continues on and the love for UGG continues to spread.</p>
  </div>
</section>
  
</div>

If you met, from a long study in the code, it is all done with CSS does not need JS!

Source: https://codepen.io/designbyremedy/pen/aqjLx?limit=all&page=2&q=parallax

Article to learn more about Parallax, all in Portuguese

https://jwebcoder.wordpress.com/2013/07/16/parallax-simples-e-facil/

Video on Youtube https://www.youtube.com/watch?v=xEEGOUnd19M

Browser other questions tagged

You are not signed in. Login or sign up in order to post.