Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 :)