Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.0/css/bootstrap.min.css" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.0/js/bootstrap.min.js"></script>

<script>
	jQuery(document).ready(function($){
	    var offset = $( "#header" ).offset();
	    checkOffset();
	    $(window).scroll(function() {
	        checkOffset();
	    });
	    function checkOffset() {
	        if ( $(document).scrollTop() > offset.top){
	            $('#header').addClass('fixed');
	        } else {
	            $('#header').removeClass('fixed');
	        }
	    }
	});
	</script>
	<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
		<div class="container">
			<a class="navbar-brand" href="#">Navbar</a>
			<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExample" aria-controls="navbarsExample" aria-expanded="false" aria-label="Toggle navigation">
				<span class="navbar-toggler-icon"></span>
			</button>
			<div class="collapse navbar-collapse" id="navbarsExample">
				<ul class="navbar-nav mr-auto">
					<li class="nav-item active">
						<a class="nav-link" href="#">Link <span class="sr-only">(current)</span></a>
					</li>
				</ul>
			</div>
		</div>
	</nav>
	<div class="page-wrap">
		<div class="container">
			<div id="header">
				<h1 class="heading">Make This Responsive</h1>
			</div>
			<div class="content" id="mostImportant">
				<p>While maintaining the heirarchy of importance.</p>
				<ul>
					<li>Create a js function to cycle through primary image.</li>
					<li>Use inline js to change secondary story images.</li>
					<li>Make the main heading stick to the top on scrolling.</li>
					<li>Use SASS/SCSS to produce your css files. </li>
					<li>Use the package manager of your choice to concatenate and minify your js and css files. </li>
					<li>Put your project on <a href="https://github.com/zom-b-food/scss-template" target="_blank">
						GitHub
					</a>.</li>
				</ul>
				<article class="main-story" id="next">
					<img id="image" src="https://picsum.photos/800/391?image=162" alt="Placeholder Image" class="img-fluid"/>
					<div class="story-intro">
						<h1>Most Important Story</h1>
						<p>This article has the most visual weight. <a href="https://picsum.photos/images" target=_"blank">Find out more here</a></p>
					</div>
				</article>
				<!-- Marketing Icons Section -->
				<section class="sub-stories">
					<div class="row">
						<div class="col-lg-4 mb-2">
							<article class="sub-story">
								<img src="https://picsum.photos/250/350/?image=1062" class="img-fluid" onclick="this.src='https://picsum.photos/250/350/?image=335'"/>
								<div class="story-intro">
									<h2>Less Important Story 1</h2>
									<p>This story has less visual weight.</p>
								</div>
							</article>
						</div>
						<div class="col-lg-4" mb-2>
							<article class="sub-story">
								<img src="https://picsum.photos/250/350/?image=530" class="img-fluid" onclick="this.src='https://picsum.photos/250/350/?image=435'"/>
								<div class="story-intro">
									<h2>Less Important Story 2</h2>
									<p>This story has less visual weight.</p>
								</div>
							</article>
						</div>
						<div class="col-lg-4 mb-2">
							<article class="sub-story last">
								<img src="https://picsum.photos/250/350/?image=40" class="img-fluid" onclick="this.src='https://picsum.photos/250/350/?image=535'"/>
								<div class="story-intro">
									<h2>Less Important Story 3</h2>
									<p>This story has less visual weight.</p>
								</div>
							</article>
						</div>
					</div>
					<!-- /.row -->
				</section>
				<h2>
					READme
				</h2>
				<p>
					The "Most Important Story" div will trigger a function that randomly changes the images. My array only contains three images, but you get the idea. I wanted to demonstrate that I know how to write an array and click through items in that array.
				</p>
				<p>
					The three Less Important stories use an inline onclick to advance to another random image. I wanted to demonstrate that I can use js inline when warranted.
				</p>
				<p>
					On mobile, I lightened the background opacity of the main-story class header since it obscured the image.
				</p>
				<p>
					The black text in the Sticky Header is hidden when the image is dark, so I added a subtle gradient so you can read it against a dark background. It's virtually unnoticable on a light background.
				</p>
				<p>
					The "Find out More Here" link opens in a new window, which is the better approach for this assignment.
				</p>
				<p>
					I had to add some Lorem ipsum so you had room to scroll...and to demonstrate the back to top link.
				</p>
				<p>
					Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reiciendis ipsam eos, nam perspiciatis natus commodi similique totam consectetur praesentium molestiae atque exercitationem ut consequuntur, sed eveniet, magni nostrum sint fuga. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reiciendis ipsam eos, nam perspiciatis natus commodi similique totam consectetur praesentium molestiae atque exercitationem ut consequuntur, sed eveniet, magni nostrum sint fuga. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reiciendis ipsam eos, nam perspiciatis natus commodi similique totam consectetur praesentium molestiae atque exercitationem ut consequuntur, sed eveniet, magni nostrum sint fuga.
				</p>
				<a href="#mostImportant">Back to top</a>
			</div>
		</div>
	</div>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

.page-wrap {
  max-width: 800px;
  margin: 20px auto;
}

#header {
  z-index: 1030;
}

.main-story {
  position: relative;
  margin: 0 0 25px 0;
}

.fixed {
  position: fixed;
  top: 0;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: lightblue;
}

.story-intro {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.75);
  padding: 20px;
  color: white;
}
.story-intro h1 {
  font-size: 2.5rem;
}
.story-intro p {
  margin: 0;
}

h2 {
  font-size: 1.25rem !important;
  margin: 0 0 10px 0;
}

.sub-stories {
  overflow: hidden;
  margin: 0 0 25px 0;
}

.sub-story {
  float: left;
  width: 250px;
  margin-right: 25px;
  position: relative;
  font-size: 80%;
}

.last {
  margin-right: 0;
}

h1.heading {
  font-size: 4.5rem;
  width: 800px;
  margin: 0 auto;
  padding-left: 10px;
  background-color: rgba(255, 255, 255, 0.5);
}

.content {
  margin-top: 20px;
}

@media screen and (min-width: 478px) and (max-width: 804px) {
  h1.heading {
    font-size: 3rem;
  }

  .story-intro {
    background: rgba(0, 0, 0, 0.25);
  }
  .story-intro h1.heading {
    font-size: 1.5rem;
    line-height: 1;
  }

  h2 {
    font-size: 1.5rem;
  }

  article:last-of-type {
    margin-top: 32px;
  }
}
@media screen and (max-width: 477px) {
  h1.heading {
    font-size: 2rem;
  }

  .story-intro {
    background: rgba(0, 0, 0, 0.25);
  }
  .story-intro h1 {
    font-size: 1.2rem;
    line-height: 1;
  }

  h2 {
    font-size: 1.15rem;
  }

  article:last-of-type {
    margin-top: 34px;
  }
}
@media screen and (max-width: 397px) {
  h1.heading {
    font-size: 1.75rem;
  }
}

/*# sourceMappingURL=custom.css.map */

              
            
!

JS

              
                 $( document ).ready(function() {

        var images = [
            "https://picsum.photos/800/391/?image=335",
            "https://picsum.photos/800/391/?image=443",
            "https://picsum.photos/800/391/?image=513"    
        ];

        var imageIndex = 0;

        
        $("#next").on("click", function(){
            imageIndex = (imageIndex+1) % (images.length);    
            $("#image").attr('src', images[imageIndex]);
        });

        $("#image").attr(images[0]);

    });
              
            
!
999px

Console