Skip to content

Commit

Permalink
Added floating button to the top
Browse files Browse the repository at this point in the history
  • Loading branch information
Srijita-Mandal committed Feb 14, 2022
1 parent 89fc23a commit 6e6941a
Show file tree
Hide file tree
Showing 10 changed files with 253 additions and 6 deletions.
22 changes: 22 additions & 0 deletions Blog/blog.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
</head>

<body>

<!-- floating button to the top -->
<a href="#" id="scroll"><span></span></a>

<!-- Navigation -->

<header>
Expand Down Expand Up @@ -678,5 +682,23 @@ <h4 class="text-gray">
big_wrapper.classList.toggle("active");
});
</script>

<script>
// floating button to the top
$(document).ready(function() {
$(document).scroll(function(){
if($(this).scrollTop() > 100){
$("#scroll").fadeIn();
} else{
$("#scroll").fadeOut();
}
});
$("#scroll").click(function () {
$("html,body").animate({scrollTop:0},600);
return false;
});
});

</script>
</body>
</html>
35 changes: 35 additions & 0 deletions Blog/css/Style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,41 @@ body {
overflow-x: hidden;
}

#scroll{
position: fixed;
right: 10px;
bottom: 10px;
cursor: pointer;
width: 50px;
height: 50px;
background-color: #49c9f8;
text-indent: -9999px;
display: none;
border-radius: 60px;
z-index: 20;
box-shadow: 0px 0px 13px rgba(0,0,0,0.1);
}

#scroll span {
position: absolute;
top: 50%;
left: 50%;
margin-left: -8px;
margin-top: -12px;
height: 0;
width: 0;
border: 8px solid transparent;
border-bottom-color: #000000;
}

#scroll:hover{
background-color: #038cbe;
opacity: 1;
filter: "alpha(opacity=100)";
-ms-filter: "alpha(opacity=100)";
}


:root {
/* Theme colors */
--text-gray: #3f4954;
Expand Down
23 changes: 23 additions & 0 deletions Course/Courses.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
</head>

<body>

<!-- floating button to the top -->
<a href="#" id="scroll"><span></span></a>


<div class="sidebar">
<div class="logo-details">
Expand Down Expand Up @@ -279,6 +283,25 @@ <h3>follow us</h3>
}
}
</script>

<script>
// floating button to the top
$(document).ready(function() {
$(document).scroll(function(){
if($(this).scrollTop() > 100){
$("#scroll").fadeIn();
} else{
$("#scroll").fadeOut();
}
});
$("#scroll").click(function () {
$("html,body").animate({scrollTop:0},600);
return false;
});
});

</script>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/5.4.5/js/swiper.min.js"></script>
<!-- custom js file link -->
<script src="js/script.js"></script>
Expand Down
35 changes: 35 additions & 0 deletions Course/css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion Course/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,21 @@ document.querySelectorAll('.course-3 .box .video video').forEach(vid =>{

document.querySelector('#close-vid').onclick = () =>{
mainVid.classList.remove('active');
}
}


// floating button to the top
$(document).ready(function() {
$(document).scroll(function(){
if($(this).scrollTop() > 100){
$("#scroll").fadeIn();
} else{
$("#scroll").fadeOut();
}
});
$("#scroll").click(function () {
$("html,body").animate({scrollTop:0},600);
return false;
});
});

34 changes: 34 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,40 @@ html{
color: var(--black);
}

#scroll{
position: fixed;
right: 10px;
bottom: 10px;
cursor: pointer;
width: 50px;
height: 50px;
background-color: #49c9f8;
text-indent: -9999px;
display: none;
border-radius: 60px;
z-index: 20;
box-shadow: 0px 0px 13px rgba(0,0,0,0.1);
}

#scroll span {
position: absolute;
top: 50%;
left: 50%;
margin-left: -8px;
margin-top: -12px;
height: 0;
width: 0;
border: 8px solid transparent;
border-bottom-color: #000000;
}

#scroll:hover{
background-color: #038cbe;
opacity: 1;
filter: "alpha(opacity=100)";
-ms-filter: "alpha(opacity=100)";
}


/* welcome */
.welcome{
Expand Down
35 changes: 35 additions & 0 deletions feature-pg/features.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,41 @@ body {
overflow-x: hidden;
}

#scroll{
position: fixed;
right: 10px;
bottom: 10px;
cursor: pointer;
width: 50px;
height: 50px;
background-color: #49c9f8;
text-indent: -9999px;
display: none;
border-radius: 60px;
z-index: 20;
box-shadow: 0px 0px 13px rgba(0,0,0,0.1);
}

#scroll span {
position: absolute;
top: 50%;
left: 50%;
margin-left: -8px;
margin-top: -12px;
height: 0;
width: 0;
border: 8px solid transparent;
border-bottom-color: #000000;
}

#scroll:hover{
background-color: #038cbe;
opacity: 1;
filter: "alpha(opacity=100)";
-ms-filter: "alpha(opacity=100)";
}


:root {
/* Theme colors */
--text-gray: #3f4954;
Expand Down
5 changes: 5 additions & 0 deletions feature-pg/features.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@

<body>

<!-- floating button to the top -->
<a href="#" id="scroll"><span></span></a>


<!-- Navigation -->

<header>
Expand Down Expand Up @@ -396,6 +400,7 @@ <h4 class="text-gray">
</div>
</footer>


<!-- -------------x------------- Footer --------------------x------------------- -->

<!-- Jquery Library file -->
Expand Down
29 changes: 24 additions & 5 deletions feature-pg/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,30 @@ $(document).ready(function () {


// click to scroll top
$('.move-up span').click(function () {
$('html, body').animate({
scrollTop: 0
}, 1000);
})
// $('.move-up span').click(function () {
// $('html, body').animate({
// scrollTop: 0
// }, 1000);
// })


// floating button to the top

$(document).scroll(function(){
if($(this).scrollTop() > 100){
$("#scroll").fadeIn();
} else{
$("#scroll").fadeOut();
}
});
$("#scroll").click(function () {
$("html,body").animate({scrollTop:0},600);
return false;
});





// AOS Instance
AOS.init();
Expand Down
22 changes: 22 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@

<body>
<div id="preloader"></div>

<!-- floating button to the top -->
<a href="#" id="scroll"><span></span></a>

<main>
<div class="big-wrapper light">
<img src="img/shape.png" alt="" class="shape" />
Expand Down Expand Up @@ -660,5 +664,23 @@ <h3 class="lg-text">Have a Question?</h3>
preloader.style.display = "none";
})
</script>

<script>
// floating button to the top
$(document).ready(function() {
$(document).scroll(function(){
if($(this).scrollTop() > 100){
$("#scroll").fadeIn();
} else{
$("#scroll").fadeOut();
}
});
$("#scroll").click(function () {
$("html,body").animate({scrollTop:0},600);
return false;
});
});

</script>
</body>
</html>

0 comments on commit 6e6941a

Please sign in to comment.