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 Review jQuery Plugin Options

In the video, he used coding that was much more simpler than mine. How do I know where I can simplify my code?

In the video, he used...

$('.work').on('sticky-start', function () { $(this).append('<a href="mailto:example@example.com" class="email-text"> Email us</a>'); });

$('.work').on('sticky-end', function () { $('.email-text').remove(); });

I used...

$('.work').on('sticky-start', function () { $('.work').html('Want us to work on your project? <a href="mailto:example@example.com" class="email-text"> Email us</a>'); });

$('.work').on('sticky-end', function () { $('.work').html('Want us to work on your project?'); });

Both work of course, but I want to know how do I know where I can simply my coding? Also what is Email&npsp;us?

1 Answer

Steven Parker
Steven Parker
231,269 Points

:point_right: Efficiency comes with practice.

As you do more development, you gradually build a "mental toolbox" of practices and strategies, and which situations they handle more efficiently. But I also notice that your code adds an extra message that the more concise code doesn't. If you remove that difference, the code sizes will be very close.

And I suspect you misspelled "&nbsp;", which is the HTML character code for "non-breaking space". It will appear as a space in the document, but it insures that the words on either side of it will appear on the same line.