scrollTop addclass makes a jump










0















I am pretty much a newbie in coding, and i am currently working on a company as part of my studies.
They gave me an html and css file to edit, i had to make an image appear and disappear depending on the distance scrolled. I managed to make the class disappear after getting to a concrete distance from the top, but it makes a weird jump. The code isn't mine, i just edited some things so if any information is missing please tell me so i can add it.



The HTML goes like this:



jQuery("document").ready(function($){ 

var nav = $('#feedback_form');

$(window).scroll(function ()
if ($(this).scrollTop() > 445 && $(this).scrollTop() < 1289 )
nav.addClass("f-nav");
else
nav.removeClass("f-nav");


);


And the "f-nav" class it's referring to in the css is this one:



.f-nav 
z-index: 9998!important;
position: fixed!important;
top: 0;

-webkit-animation: fadeIn ease-in 1; /* Safari and Chrome */
-moz-animation: fadeIn ease-in 1; /* Firefox */
-ms-animation: fadeIn ease-in 1; /* Internet Explorer */
-o-animation: fadeIn ease-in 1; /* Opera */
animation: fadeIn ease-in 1;

-webkit-animation-duration:2s;
-moz-animation-duration:2s;
-ms-animation-duration:2s;
-o-animation-duration:2s;
animation-duration:2s;




The addClass also makes a jump but it's less noticeable.
Like i said im pretty new to this so i don't know where the problem could be coming from.



Here's a gyazo to the problem:



https://gyazo.com/9b3e0a910c095fa3b180b9501eed9981










share|improve this question
























  • Use position:sticky

    – Just code
    Nov 13 '18 at 9:07











  • I changed the position to sticky from fixed, but the jump is still there when the class gets removed.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 10:36











  • You can provide a demo to reproduce the problem first.

    – Just code
    Nov 13 '18 at 10:44











  • I'm not quite allowed to share too much of the HTML or CSS because it's from my company, not mine. That's why i wanted to know if, with the data that i shared, someone could find the cause of the problem or a solution. Also I don't know enough as to make a demo since i'm not sure of which codelines are important and which aren't.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 10:54











  • Also i just realized that you can't see the faces before they appear on the scroll, while using my code the faces are there and they follow the scroll once gone under them. The only problem in my code is the little jumps it makes for some reason.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:29
















0















I am pretty much a newbie in coding, and i am currently working on a company as part of my studies.
They gave me an html and css file to edit, i had to make an image appear and disappear depending on the distance scrolled. I managed to make the class disappear after getting to a concrete distance from the top, but it makes a weird jump. The code isn't mine, i just edited some things so if any information is missing please tell me so i can add it.



The HTML goes like this:



jQuery("document").ready(function($){ 

var nav = $('#feedback_form');

$(window).scroll(function ()
if ($(this).scrollTop() > 445 && $(this).scrollTop() < 1289 )
nav.addClass("f-nav");
else
nav.removeClass("f-nav");


);


And the "f-nav" class it's referring to in the css is this one:



.f-nav 
z-index: 9998!important;
position: fixed!important;
top: 0;

-webkit-animation: fadeIn ease-in 1; /* Safari and Chrome */
-moz-animation: fadeIn ease-in 1; /* Firefox */
-ms-animation: fadeIn ease-in 1; /* Internet Explorer */
-o-animation: fadeIn ease-in 1; /* Opera */
animation: fadeIn ease-in 1;

-webkit-animation-duration:2s;
-moz-animation-duration:2s;
-ms-animation-duration:2s;
-o-animation-duration:2s;
animation-duration:2s;




The addClass also makes a jump but it's less noticeable.
Like i said im pretty new to this so i don't know where the problem could be coming from.



Here's a gyazo to the problem:



https://gyazo.com/9b3e0a910c095fa3b180b9501eed9981










share|improve this question
























  • Use position:sticky

    – Just code
    Nov 13 '18 at 9:07











  • I changed the position to sticky from fixed, but the jump is still there when the class gets removed.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 10:36











  • You can provide a demo to reproduce the problem first.

    – Just code
    Nov 13 '18 at 10:44











  • I'm not quite allowed to share too much of the HTML or CSS because it's from my company, not mine. That's why i wanted to know if, with the data that i shared, someone could find the cause of the problem or a solution. Also I don't know enough as to make a demo since i'm not sure of which codelines are important and which aren't.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 10:54











  • Also i just realized that you can't see the faces before they appear on the scroll, while using my code the faces are there and they follow the scroll once gone under them. The only problem in my code is the little jumps it makes for some reason.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:29














0












0








0








I am pretty much a newbie in coding, and i am currently working on a company as part of my studies.
They gave me an html and css file to edit, i had to make an image appear and disappear depending on the distance scrolled. I managed to make the class disappear after getting to a concrete distance from the top, but it makes a weird jump. The code isn't mine, i just edited some things so if any information is missing please tell me so i can add it.



The HTML goes like this:



jQuery("document").ready(function($){ 

var nav = $('#feedback_form');

$(window).scroll(function ()
if ($(this).scrollTop() > 445 && $(this).scrollTop() < 1289 )
nav.addClass("f-nav");
else
nav.removeClass("f-nav");


);


And the "f-nav" class it's referring to in the css is this one:



.f-nav 
z-index: 9998!important;
position: fixed!important;
top: 0;

-webkit-animation: fadeIn ease-in 1; /* Safari and Chrome */
-moz-animation: fadeIn ease-in 1; /* Firefox */
-ms-animation: fadeIn ease-in 1; /* Internet Explorer */
-o-animation: fadeIn ease-in 1; /* Opera */
animation: fadeIn ease-in 1;

-webkit-animation-duration:2s;
-moz-animation-duration:2s;
-ms-animation-duration:2s;
-o-animation-duration:2s;
animation-duration:2s;




The addClass also makes a jump but it's less noticeable.
Like i said im pretty new to this so i don't know where the problem could be coming from.



Here's a gyazo to the problem:



https://gyazo.com/9b3e0a910c095fa3b180b9501eed9981










share|improve this question
















I am pretty much a newbie in coding, and i am currently working on a company as part of my studies.
They gave me an html and css file to edit, i had to make an image appear and disappear depending on the distance scrolled. I managed to make the class disappear after getting to a concrete distance from the top, but it makes a weird jump. The code isn't mine, i just edited some things so if any information is missing please tell me so i can add it.



The HTML goes like this:



jQuery("document").ready(function($){ 

var nav = $('#feedback_form');

$(window).scroll(function ()
if ($(this).scrollTop() > 445 && $(this).scrollTop() < 1289 )
nav.addClass("f-nav");
else
nav.removeClass("f-nav");


);


And the "f-nav" class it's referring to in the css is this one:



.f-nav 
z-index: 9998!important;
position: fixed!important;
top: 0;

-webkit-animation: fadeIn ease-in 1; /* Safari and Chrome */
-moz-animation: fadeIn ease-in 1; /* Firefox */
-ms-animation: fadeIn ease-in 1; /* Internet Explorer */
-o-animation: fadeIn ease-in 1; /* Opera */
animation: fadeIn ease-in 1;

-webkit-animation-duration:2s;
-moz-animation-duration:2s;
-ms-animation-duration:2s;
-o-animation-duration:2s;
animation-duration:2s;




The addClass also makes a jump but it's less noticeable.
Like i said im pretty new to this so i don't know where the problem could be coming from.



Here's a gyazo to the problem:



https://gyazo.com/9b3e0a910c095fa3b180b9501eed9981







javascript jquery html scrolltop






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 9:09









Vadim Kotov

4,78163549




4,78163549










asked Nov 13 '18 at 9:03









Jan Fernando Pavel GilJan Fernando Pavel Gil

235




235












  • Use position:sticky

    – Just code
    Nov 13 '18 at 9:07











  • I changed the position to sticky from fixed, but the jump is still there when the class gets removed.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 10:36











  • You can provide a demo to reproduce the problem first.

    – Just code
    Nov 13 '18 at 10:44











  • I'm not quite allowed to share too much of the HTML or CSS because it's from my company, not mine. That's why i wanted to know if, with the data that i shared, someone could find the cause of the problem or a solution. Also I don't know enough as to make a demo since i'm not sure of which codelines are important and which aren't.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 10:54











  • Also i just realized that you can't see the faces before they appear on the scroll, while using my code the faces are there and they follow the scroll once gone under them. The only problem in my code is the little jumps it makes for some reason.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:29


















  • Use position:sticky

    – Just code
    Nov 13 '18 at 9:07











  • I changed the position to sticky from fixed, but the jump is still there when the class gets removed.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 10:36











  • You can provide a demo to reproduce the problem first.

    – Just code
    Nov 13 '18 at 10:44











  • I'm not quite allowed to share too much of the HTML or CSS because it's from my company, not mine. That's why i wanted to know if, with the data that i shared, someone could find the cause of the problem or a solution. Also I don't know enough as to make a demo since i'm not sure of which codelines are important and which aren't.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 10:54











  • Also i just realized that you can't see the faces before they appear on the scroll, while using my code the faces are there and they follow the scroll once gone under them. The only problem in my code is the little jumps it makes for some reason.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:29

















Use position:sticky

– Just code
Nov 13 '18 at 9:07





Use position:sticky

– Just code
Nov 13 '18 at 9:07













I changed the position to sticky from fixed, but the jump is still there when the class gets removed.

– Jan Fernando Pavel Gil
Nov 13 '18 at 10:36





I changed the position to sticky from fixed, but the jump is still there when the class gets removed.

– Jan Fernando Pavel Gil
Nov 13 '18 at 10:36













You can provide a demo to reproduce the problem first.

– Just code
Nov 13 '18 at 10:44





You can provide a demo to reproduce the problem first.

– Just code
Nov 13 '18 at 10:44













I'm not quite allowed to share too much of the HTML or CSS because it's from my company, not mine. That's why i wanted to know if, with the data that i shared, someone could find the cause of the problem or a solution. Also I don't know enough as to make a demo since i'm not sure of which codelines are important and which aren't.

– Jan Fernando Pavel Gil
Nov 13 '18 at 10:54





I'm not quite allowed to share too much of the HTML or CSS because it's from my company, not mine. That's why i wanted to know if, with the data that i shared, someone could find the cause of the problem or a solution. Also I don't know enough as to make a demo since i'm not sure of which codelines are important and which aren't.

– Jan Fernando Pavel Gil
Nov 13 '18 at 10:54













Also i just realized that you can't see the faces before they appear on the scroll, while using my code the faces are there and they follow the scroll once gone under them. The only problem in my code is the little jumps it makes for some reason.

– Jan Fernando Pavel Gil
Nov 13 '18 at 15:29






Also i just realized that you can't see the faces before they appear on the scroll, while using my code the faces are there and they follow the scroll once gone under them. The only problem in my code is the little jumps it makes for some reason.

– Jan Fernando Pavel Gil
Nov 13 '18 at 15:29













2 Answers
2






active

oldest

votes


















0














Try this, it'll work



if ($(window).scrollTop() > 445 || $("html").scrollTop() > 289) 
$("#feedback_form").fadeIn();
else
$("#feedback_form").fadeOut();
;


Are you sure that in your code, $(this) is declared?
Accept if my code work, or let me know if there is anything. I can help you.






share|improve this answer























  • If i use that instead of what i have, it does dissimulate the jump (thanks!), but then the images don't follow throught the scroll. My objective is that the faces follow the scroll until a certain point and then disappear (As shown in the gyazo). About the $(this), where do i look if it's declared? Is it supposed to have a class in the css?

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 10:29



















0














Sorry to write code here I have to make another answer:
About the $(this), you have to know what is $(this). For example:



$(".ex").click(function()
$(this).addClass("example");
)


$(this) above mean $(".ex).



And the images don't follow throught the scroll I think it's because of z-index (maybe).



So try this:



if ($(window).scrollTop() > 445 || $("html").scrollTop() < 1289) 
$("#feedback_form").fadeIn().addClass("myClass");
else
$("#feedback_form").fadeOut();
;


with



.myClass
position: fixed; /*add !important if you need*/
z-index: 9999; /*add !important if you need*/
width: 100%;






share|improve this answer

























  • With the code you wrote it does appear smoothly, but it doesn't disappear when you get to the end of the page. Also it appears in the middle of the page and smaller than it should. But the main problem is kind of solved.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:13











  • Actually, I did something wrong at: if ($(window).scrollTop() > 445 || $("html").scrollTop() > 289) and I fixed it: if ($(window).scrollTop() > 445 || $("html").scrollTop() < 1289). Upvote and accept the answer if it helps you. Thank you

    – Luu Hoang Bac
    Nov 13 '18 at 15:16











  • In fact, when i use "< 1289" instead of "> 289" it doesn't disappear at all. Also i still don't know why it's in the middle of the apge or why it's smaller than it should. Does it have to do with the css?

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:26











  • Maybe it because your web's height is smaller than 1289, so change the number "1289" to a smaller number. And it's smaller than it should because of the css position: fixed, use can add: width: 100% (or a number) to class .myClass

    – Luu Hoang Bac
    Nov 13 '18 at 15:32











  • It still makes the same, i'm going to keep trying with different values or mixing your code with mine, if it works I'll accept the answer.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:42










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277282%2fscrolltop-addclass-makes-a-jump%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Try this, it'll work



if ($(window).scrollTop() > 445 || $("html").scrollTop() > 289) 
$("#feedback_form").fadeIn();
else
$("#feedback_form").fadeOut();
;


Are you sure that in your code, $(this) is declared?
Accept if my code work, or let me know if there is anything. I can help you.






share|improve this answer























  • If i use that instead of what i have, it does dissimulate the jump (thanks!), but then the images don't follow throught the scroll. My objective is that the faces follow the scroll until a certain point and then disappear (As shown in the gyazo). About the $(this), where do i look if it's declared? Is it supposed to have a class in the css?

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 10:29
















0














Try this, it'll work



if ($(window).scrollTop() > 445 || $("html").scrollTop() > 289) 
$("#feedback_form").fadeIn();
else
$("#feedback_form").fadeOut();
;


Are you sure that in your code, $(this) is declared?
Accept if my code work, or let me know if there is anything. I can help you.






share|improve this answer























  • If i use that instead of what i have, it does dissimulate the jump (thanks!), but then the images don't follow throught the scroll. My objective is that the faces follow the scroll until a certain point and then disappear (As shown in the gyazo). About the $(this), where do i look if it's declared? Is it supposed to have a class in the css?

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 10:29














0












0








0







Try this, it'll work



if ($(window).scrollTop() > 445 || $("html").scrollTop() > 289) 
$("#feedback_form").fadeIn();
else
$("#feedback_form").fadeOut();
;


Are you sure that in your code, $(this) is declared?
Accept if my code work, or let me know if there is anything. I can help you.






share|improve this answer













Try this, it'll work



if ($(window).scrollTop() > 445 || $("html").scrollTop() > 289) 
$("#feedback_form").fadeIn();
else
$("#feedback_form").fadeOut();
;


Are you sure that in your code, $(this) is declared?
Accept if my code work, or let me know if there is anything. I can help you.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 '18 at 9:32









Luu Hoang BacLuu Hoang Bac

12911




12911












  • If i use that instead of what i have, it does dissimulate the jump (thanks!), but then the images don't follow throught the scroll. My objective is that the faces follow the scroll until a certain point and then disappear (As shown in the gyazo). About the $(this), where do i look if it's declared? Is it supposed to have a class in the css?

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 10:29


















  • If i use that instead of what i have, it does dissimulate the jump (thanks!), but then the images don't follow throught the scroll. My objective is that the faces follow the scroll until a certain point and then disappear (As shown in the gyazo). About the $(this), where do i look if it's declared? Is it supposed to have a class in the css?

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 10:29

















If i use that instead of what i have, it does dissimulate the jump (thanks!), but then the images don't follow throught the scroll. My objective is that the faces follow the scroll until a certain point and then disappear (As shown in the gyazo). About the $(this), where do i look if it's declared? Is it supposed to have a class in the css?

– Jan Fernando Pavel Gil
Nov 13 '18 at 10:29






If i use that instead of what i have, it does dissimulate the jump (thanks!), but then the images don't follow throught the scroll. My objective is that the faces follow the scroll until a certain point and then disappear (As shown in the gyazo). About the $(this), where do i look if it's declared? Is it supposed to have a class in the css?

– Jan Fernando Pavel Gil
Nov 13 '18 at 10:29














0














Sorry to write code here I have to make another answer:
About the $(this), you have to know what is $(this). For example:



$(".ex").click(function()
$(this).addClass("example");
)


$(this) above mean $(".ex).



And the images don't follow throught the scroll I think it's because of z-index (maybe).



So try this:



if ($(window).scrollTop() > 445 || $("html").scrollTop() < 1289) 
$("#feedback_form").fadeIn().addClass("myClass");
else
$("#feedback_form").fadeOut();
;


with



.myClass
position: fixed; /*add !important if you need*/
z-index: 9999; /*add !important if you need*/
width: 100%;






share|improve this answer

























  • With the code you wrote it does appear smoothly, but it doesn't disappear when you get to the end of the page. Also it appears in the middle of the page and smaller than it should. But the main problem is kind of solved.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:13











  • Actually, I did something wrong at: if ($(window).scrollTop() > 445 || $("html").scrollTop() > 289) and I fixed it: if ($(window).scrollTop() > 445 || $("html").scrollTop() < 1289). Upvote and accept the answer if it helps you. Thank you

    – Luu Hoang Bac
    Nov 13 '18 at 15:16











  • In fact, when i use "< 1289" instead of "> 289" it doesn't disappear at all. Also i still don't know why it's in the middle of the apge or why it's smaller than it should. Does it have to do with the css?

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:26











  • Maybe it because your web's height is smaller than 1289, so change the number "1289" to a smaller number. And it's smaller than it should because of the css position: fixed, use can add: width: 100% (or a number) to class .myClass

    – Luu Hoang Bac
    Nov 13 '18 at 15:32











  • It still makes the same, i'm going to keep trying with different values or mixing your code with mine, if it works I'll accept the answer.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:42















0














Sorry to write code here I have to make another answer:
About the $(this), you have to know what is $(this). For example:



$(".ex").click(function()
$(this).addClass("example");
)


$(this) above mean $(".ex).



And the images don't follow throught the scroll I think it's because of z-index (maybe).



So try this:



if ($(window).scrollTop() > 445 || $("html").scrollTop() < 1289) 
$("#feedback_form").fadeIn().addClass("myClass");
else
$("#feedback_form").fadeOut();
;


with



.myClass
position: fixed; /*add !important if you need*/
z-index: 9999; /*add !important if you need*/
width: 100%;






share|improve this answer

























  • With the code you wrote it does appear smoothly, but it doesn't disappear when you get to the end of the page. Also it appears in the middle of the page and smaller than it should. But the main problem is kind of solved.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:13











  • Actually, I did something wrong at: if ($(window).scrollTop() > 445 || $("html").scrollTop() > 289) and I fixed it: if ($(window).scrollTop() > 445 || $("html").scrollTop() < 1289). Upvote and accept the answer if it helps you. Thank you

    – Luu Hoang Bac
    Nov 13 '18 at 15:16











  • In fact, when i use "< 1289" instead of "> 289" it doesn't disappear at all. Also i still don't know why it's in the middle of the apge or why it's smaller than it should. Does it have to do with the css?

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:26











  • Maybe it because your web's height is smaller than 1289, so change the number "1289" to a smaller number. And it's smaller than it should because of the css position: fixed, use can add: width: 100% (or a number) to class .myClass

    – Luu Hoang Bac
    Nov 13 '18 at 15:32











  • It still makes the same, i'm going to keep trying with different values or mixing your code with mine, if it works I'll accept the answer.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:42













0












0








0







Sorry to write code here I have to make another answer:
About the $(this), you have to know what is $(this). For example:



$(".ex").click(function()
$(this).addClass("example");
)


$(this) above mean $(".ex).



And the images don't follow throught the scroll I think it's because of z-index (maybe).



So try this:



if ($(window).scrollTop() > 445 || $("html").scrollTop() < 1289) 
$("#feedback_form").fadeIn().addClass("myClass");
else
$("#feedback_form").fadeOut();
;


with



.myClass
position: fixed; /*add !important if you need*/
z-index: 9999; /*add !important if you need*/
width: 100%;






share|improve this answer















Sorry to write code here I have to make another answer:
About the $(this), you have to know what is $(this). For example:



$(".ex").click(function()
$(this).addClass("example");
)


$(this) above mean $(".ex).



And the images don't follow throught the scroll I think it's because of z-index (maybe).



So try this:



if ($(window).scrollTop() > 445 || $("html").scrollTop() < 1289) 
$("#feedback_form").fadeIn().addClass("myClass");
else
$("#feedback_form").fadeOut();
;


with



.myClass
position: fixed; /*add !important if you need*/
z-index: 9999; /*add !important if you need*/
width: 100%;







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 13 '18 at 15:37

























answered Nov 13 '18 at 14:39









Luu Hoang BacLuu Hoang Bac

12911




12911












  • With the code you wrote it does appear smoothly, but it doesn't disappear when you get to the end of the page. Also it appears in the middle of the page and smaller than it should. But the main problem is kind of solved.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:13











  • Actually, I did something wrong at: if ($(window).scrollTop() > 445 || $("html").scrollTop() > 289) and I fixed it: if ($(window).scrollTop() > 445 || $("html").scrollTop() < 1289). Upvote and accept the answer if it helps you. Thank you

    – Luu Hoang Bac
    Nov 13 '18 at 15:16











  • In fact, when i use "< 1289" instead of "> 289" it doesn't disappear at all. Also i still don't know why it's in the middle of the apge or why it's smaller than it should. Does it have to do with the css?

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:26











  • Maybe it because your web's height is smaller than 1289, so change the number "1289" to a smaller number. And it's smaller than it should because of the css position: fixed, use can add: width: 100% (or a number) to class .myClass

    – Luu Hoang Bac
    Nov 13 '18 at 15:32











  • It still makes the same, i'm going to keep trying with different values or mixing your code with mine, if it works I'll accept the answer.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:42

















  • With the code you wrote it does appear smoothly, but it doesn't disappear when you get to the end of the page. Also it appears in the middle of the page and smaller than it should. But the main problem is kind of solved.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:13











  • Actually, I did something wrong at: if ($(window).scrollTop() > 445 || $("html").scrollTop() > 289) and I fixed it: if ($(window).scrollTop() > 445 || $("html").scrollTop() < 1289). Upvote and accept the answer if it helps you. Thank you

    – Luu Hoang Bac
    Nov 13 '18 at 15:16











  • In fact, when i use "< 1289" instead of "> 289" it doesn't disappear at all. Also i still don't know why it's in the middle of the apge or why it's smaller than it should. Does it have to do with the css?

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:26











  • Maybe it because your web's height is smaller than 1289, so change the number "1289" to a smaller number. And it's smaller than it should because of the css position: fixed, use can add: width: 100% (or a number) to class .myClass

    – Luu Hoang Bac
    Nov 13 '18 at 15:32











  • It still makes the same, i'm going to keep trying with different values or mixing your code with mine, if it works I'll accept the answer.

    – Jan Fernando Pavel Gil
    Nov 13 '18 at 15:42
















With the code you wrote it does appear smoothly, but it doesn't disappear when you get to the end of the page. Also it appears in the middle of the page and smaller than it should. But the main problem is kind of solved.

– Jan Fernando Pavel Gil
Nov 13 '18 at 15:13





With the code you wrote it does appear smoothly, but it doesn't disappear when you get to the end of the page. Also it appears in the middle of the page and smaller than it should. But the main problem is kind of solved.

– Jan Fernando Pavel Gil
Nov 13 '18 at 15:13













Actually, I did something wrong at: if ($(window).scrollTop() > 445 || $("html").scrollTop() > 289) and I fixed it: if ($(window).scrollTop() > 445 || $("html").scrollTop() < 1289). Upvote and accept the answer if it helps you. Thank you

– Luu Hoang Bac
Nov 13 '18 at 15:16





Actually, I did something wrong at: if ($(window).scrollTop() > 445 || $("html").scrollTop() > 289) and I fixed it: if ($(window).scrollTop() > 445 || $("html").scrollTop() < 1289). Upvote and accept the answer if it helps you. Thank you

– Luu Hoang Bac
Nov 13 '18 at 15:16













In fact, when i use "< 1289" instead of "> 289" it doesn't disappear at all. Also i still don't know why it's in the middle of the apge or why it's smaller than it should. Does it have to do with the css?

– Jan Fernando Pavel Gil
Nov 13 '18 at 15:26





In fact, when i use "< 1289" instead of "> 289" it doesn't disappear at all. Also i still don't know why it's in the middle of the apge or why it's smaller than it should. Does it have to do with the css?

– Jan Fernando Pavel Gil
Nov 13 '18 at 15:26













Maybe it because your web's height is smaller than 1289, so change the number "1289" to a smaller number. And it's smaller than it should because of the css position: fixed, use can add: width: 100% (or a number) to class .myClass

– Luu Hoang Bac
Nov 13 '18 at 15:32





Maybe it because your web's height is smaller than 1289, so change the number "1289" to a smaller number. And it's smaller than it should because of the css position: fixed, use can add: width: 100% (or a number) to class .myClass

– Luu Hoang Bac
Nov 13 '18 at 15:32













It still makes the same, i'm going to keep trying with different values or mixing your code with mine, if it works I'll accept the answer.

– Jan Fernando Pavel Gil
Nov 13 '18 at 15:42





It still makes the same, i'm going to keep trying with different values or mixing your code with mine, if it works I'll accept the answer.

– Jan Fernando Pavel Gil
Nov 13 '18 at 15:42

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277282%2fscrolltop-addclass-makes-a-jump%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế