Search code examples
csszurb-foundationorbit

Zurb Orbit: add text over images


I would to add a Title and Description foreach slide, something like this:

enter image description here

  <!-- Header -->
  <div id="featured">
      <img src="http://cf2.imgobject.com/t/p/w780/fI3ucpgaVKOUcQ82vhgWmWuLlg2.jpg">
      <img  src="http://cf2.imgobject.com/t/p/w780/dAc3Ob868XGnAX8uOptb7HWx0In.jpg">
      <img  src="http://cf2.imgobject.com/t/p/w780/2fwHVLvh6kdwCujsMwtNmwRJAf1.jpg">   
  </div>

<script type="text/javascript">
    $(window).load(function() {

       $('#featured').orbit();
    });
  </script>

I've tried with "captions" but I don't get the same effect. How I could do?

Zurb Fondation Orbit


Solution

  • I am working with Foundation right now so I will try to help you with it. Since I haven't done this before your feedback will be helpful.

    First in your App.js add this line for a Fluid Orbit:

    $('#featuredContent').orbit({ fluid: '800x800' });
    

    800x800 is your Orbit Slider Width and Height.

    Then in your App.css you would add this:

    #featuredContent .back {
        position: absolute;
        top: 0;
        left: 0;
        z-index: -1;
    }
    

    Which referes to your #featuredContent in your .js file and adds a .back class which we will use in our HTML code:

    <div id="featuredContent">
      <div>
        <h4>This is a content slider.</h4>
        <p>Each slide holds arbitrary content, like text or actions.</p>
        <img class="back" src="/images/test.jpg" />
      </div>
      <div>
        <h4>We can include text and buttons, like this!</h4>
        <p>We take no responsibility for what happens if you click this button.</p>
        <p><a href="http://www.youtube.com/watch?v=dQw4w9WgXcQ" class="button" target="_blank">Rock My World!</a></p>
        <img class="back" src="/images/test.jpg" />
      </div>
      <div>
        <h4>We can include text and buttons, like this!</h4>
        <p>We take no responsibility for what happens if you click this button.</p>
        <p><a href="http://www.youtube.com/watch?v=dQw4w9WgXcQ" class="button" target="_blank">Rock My World!</a></p>
        <img class="back" src="/images/test.jpg" />
      </div>
    </div>
    

    I guess this should do the trick and have the picture in the background with a title (H4) and a description (P) under it. You could also customize the position of the title and description in the css using:

    #featuredContent p {
    }
    

    and

    #featuredContent h4 {
    }