Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Using jQuery Plugins Add a Sticky Navigation Bar The Plugin Challenge Solution

Leslie Wolfe
Leslie Wolfe
8,700 Points

Added "email us" in the HTML

Hi - I wondered if using this solution is decent. I went a different route, but it works. Thanks!

HTML

<div class="grid-full">
            <h2>Our Work</h2>
            <h4>Here’s a collection of our latest app builds</h4>
            <h5>Want us to work on your project?<span class="header-show-hide"> <a href="mailto:lesliejohnswolfe@gmail.com"> Email us!</a> </span></h5>
          </div>

JavaScript

$('.grid-full h5').sticky({
  topSpacing:63
getWidthFrom: '.container',
responsiveWidth: true
});

$('.grid-full').on('sticky-start', function() {
  $('.header-show-hide').css('display', 'initial');
});

$('.grid-full').on('sticky-end', function() {
  $('.header-show-hide').css('display', 'hide');
});

CSS

.header-show-hide {
  display: none;
}

2 Answers