Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added back to top button #51

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,16 @@
// Back to top button
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('.back-to-top').fadeIn('slow');
$('#topbutton').fadeIn('slow');
} else {
$('.back-to-top').fadeOut('slow');
$('#topbutton').fadeOut('slow');
}
});

$('.back-to-top').click(function () {
$('#topbutton').click(function () {
$('html, body').animate({
scrollTop: 0
}, 1500, 'easeInOutExpo');
}, 1000, 'easeInOutExpo');
return false;
});

Expand Down
30 changes: 29 additions & 1 deletion static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
body {
font-family: "Open Sans", sans-serif;
color: #444444;

scroll-behavior: smooth;
box-sizing: border-box;
}

a {
Expand Down Expand Up @@ -67,6 +68,33 @@ h6 {
}
}

/* Back to top button */

#topbutton
{
position:fixed;
right:2%;
bottom:5%;
background-color:#2AB5E8;
border-radius: 50%;
color:#fff;
transition-duration: 0.4s;
transition-property:background-color,transform;
outline:none;
cursor:pointer;
display: none;
z-index: 1000;

}

#topbutton:hover{
background-color:#1f7b9c;
transform: scale(1.2);
}


/**************************/

.usernamelink{
font-weight: 600;
pointer-events: none;
Expand Down
16 changes: 14 additions & 2 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@
</head>

<body>

<!-- Back to top button Section -->

<button id='topbutton' class='btn btn-lg'>
<i class='fa fa-angle-double-up fa-lg' aria-hidden='true'>
</i>
</button>


<!-- End back to top button section -->

<!-- ======= Header ======= -->
<header id="header" class="fixed-top d-flex align-items-center">
<div class="container d-flex align-items-center">
Expand Down Expand Up @@ -91,7 +102,7 @@ <h1>
<!-- NAVBAR -->
</div>
</header>

<!-- End Header -->

<br>
Expand All @@ -103,7 +114,6 @@ <h1>

{% endblock %}


<!-- ======= Footer ======= -->
<section id="contact">
<div class="section-title">
Expand Down Expand Up @@ -166,6 +176,8 @@ <h4>Contact Us</h4>
</footer>
</section>
<!-- End Footer -->


</section>


Expand Down
12 changes: 12 additions & 0 deletions templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
</head>

<body>




<button id='topbutton' class='btn btn-lg'>
<i class='fa fa-angle-double-up fa-lg' aria-hidden='true'>
</i>
</button>
<!-- ======= Header ======= -->
<header id="header" class="fixed-top d-flex align-items-center">
<div class="container d-flex align-items-center">
Expand Down Expand Up @@ -495,6 +503,7 @@ <h3 class="mb-0">Electricity area Division</h3>
</div>
</div>


<!-- ======= Footer ======= -->
<section id="contact">
<div class="section-title">
Expand Down Expand Up @@ -567,6 +576,9 @@ <h4>Contact Us</h4>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.min.js"></script>
<script src="{% static 'argon.js' %}"></script>
<script src="{% static 'vendor/jquery/jquery.min.js' %}"></script>
<script src="{% static 'vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>
<script src="{% static 'vendor/jquery.easing/jquery.easing.min.js' %}"></script>

<!-- Main JS File -->
<script src="{% static 'main.js' %}"></script>
Expand Down
Loading