Search code examples
htmlcssslideshowparallaxmaterialize

How can I nest materializecss slider within a parallax?


I would like to nest a materializecss slider inside a materialcss parallax. Can this be done?

I can make each work individually fine, but when I nest them I just get a grey area with the captions.

This is my code

<div class="parallax-container">
  
<div class="parallax">
      	
    <div class="slider">
        <ul class="slides">
      			<li>
        			<img src="images/new-york-city.jpg">
        			<div class="caption center-align brown-text text-darken-2">
         		 		<h3>This is our big Tagline!</h3>
          				<h5 class="light grey-text text-darken-2">Here's our small slogan.</h5>
        			</div>
      			</li>
      			
      			<li>
        			<img src="images/coffee.jpg">
        			<div class="caption center-align blue-grey-text text-darken-4">
          				<h3>This is our big Tagline!</h3>
          				<h5 class="light blue-grey-text text-darken-4">Here's our small slogan.</h5>
        			</div>
      			</li>    		
        </ul><!-- /slides -->
  	</div><!-- /slider -->
      
</div><!-- /parallax -->
</div><!-- /parallax-container -->

Thanks


Solution

  • you can use only slider like this:

          	
        <div class="slider">
            <ul class="slides">
          	    <li>
            	    <img src="images/new-york-city.jpg">
            		<div class="caption center-align brown-text text-darken-2">
             		 	<h3>This is our big Tagline!</h3>
              			<h5 class="light grey-text text-darken-2">Here's our small slogan.</h5>
            		</div>
          		</li>
          			
          		<li>
            		<img src="images/coffee.jpg">
            		<div class="caption center-align blue-grey-text text-darken-4">
              			<h3>This is our big Tagline!</h3>
              			<h5 class="light blue-grey-text text-darken-4">Here's our small slogan.</h5>
            		</div>
          		</li>    		
            </ul><!-- /slides -->
      	</div><!-- /slider -->
          

    then put this in your css file

    .slides li img {
      background-attachment: fixed;
    }
    

    it will work fine :)