/    Sign up×
Community /Pin to ProfileBookmark

How to show a div after scrolling to some section in a page?

I want to make a div which will show only on scrolling … Reference website [https://www.fastcomet.com/pricing](url)

to post a comment
CSSHTMLJavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@sagar_jaybhayMar 02.2020 — &lt;script&gt;<br/>
$(window).scroll(function() {<br/>
if ($(this).scrollTop()&gt;300)<br/>
{<br/>
$('.myDiv').hide(1000);<br/>
}<br/>
else<br/>
{<br/>
$('.myDiv').show(1000);<br/>
}<br/>
});<br/>
&lt;/script&gt;
Copy linkTweet thisAlerts:
@shobhaauthorMar 04.2020 — &lt;script&gt;function sticktothetop() {<br/>
var window_top = $(window).scrollTop();<br/>
var top = $('#stick-here').offset().top;<br/>
if (window_top &gt; top ) {<br/>
$('#stickThis').addClass('stick');<br/>
$('#stick-here').height($('#stickThis').outerHeight());<br/>
} <br/>
else {<br/>
$('#stickThis').removeClass('stick');<br/>
$('#stick-here').height(0);<br/>
}<br/>
}<br/>
$(function() {<br/>
$(window).scroll(sticktothetop);<br/>
sticktothetop();<br/>
});<br/>
&lt;/script&gt;<br/>
&lt;section&gt;<br/>
&lt;div id="stick-here"&gt;&lt;/div&gt;<br/>
&lt;div class="sticky-plans fixed-top" id="stickThis"&gt;<br/>
&lt;div class="container"&gt;<br/>
&lt;div class="row"&gt;<br/>
&lt;div class="col-lg-3 displaynone"&gt;<br/>
&lt;h4&gt;Choose Your Plan&lt;/h4&gt;<br/>
&lt;/div&gt;<br/>
&lt;div class="col-lg-9 col-12"&gt;<br/>
&lt;div class="row"&gt;<br/>
demo &lt;/div&gt;<br/>
&lt;/div&gt;<br/>
&lt;/div&gt;<br/>
&lt;/div&gt;<br/>
&lt;/div&gt;<br/>
&lt;/div&gt;<br/>
&lt;div class="container"&gt; &lt;p class="special-text"&gt;Testing&lt;/p&gt;<br/>
&lt;/div&gt;<br/>
&lt;/section&gt;
Copy linkTweet thisAlerts:
@shobhaauthorMar 04.2020 — @sagar_jaybhay#1615516 I am using this code it is showing the div after scrolling to some height but I want to hide it on scrolling to some height after it is showing..
×

Success!

Help @shobha spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...