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

Konrad Pilch
Konrad Pilch
2,435 Points

Something went wrong

HI,

Something went wrong. In this codepen, as you can see, im trying to clone the navigation when i scroll below 300px, im sure most of this code is correct, but im sure something is wrong too, hence it doesnt work. Pleaes help.

1 Answer

Tushar Singh
Tushar Singh
Courses Plus Student 8,692 Points
 /* I din't change a thing besides this*/
.fixed{
  top:0;
 position:fixed;
  width:100%;
}
Konrad Pilch
Konrad Pilch
2,435 Points

hahaha, such a silly mistake xD hah

But now its fixed all the time tho ;/

Tushar Singh
Tushar Singh
Courses Plus Student 8,692 Points

I am not sure I completely understand your problem here :O

"But now its fixed all the time tho ;/"

WHaaaaat?

What is it exactly you wanna do? Now what is happening is you have your navbar, when you scroll down it just vanishes and as soon as it hits the 300 mark, navbar appears again. So what's the problem now?(Sorry I am confused)

Konrad Pilch
Konrad Pilch
2,435 Points

Ah, solved it ! :D

I had to change this

$(navbar,'body').remove();


//my prev code before i answered here was:

$('body').remove(navbar); // which is wrong, had to change it whats above :)