CSS JavaScript jQuery Programming

Responsive back to top using jquery

Responsive back to top using jquery

Learn how to sumple create a button of “scroll back to top” button jquery with CSS.
Create a simple button that will take and use css with jquery the user to easyly the top of the page when clicked on:
Back to top buttons are a easy to top great usability HTML element of a web page or apps, and having one on we website adds a small task but helpful more detail most of us are used to.

Include jquery

<script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

Script.js

<script type='text/javascript'>
$(document).ready(function(){ 
	$(window).scroll(function(){ 
		if ($(this).scrollTop() > 100) { 
			$('#pagescroll').fadeIn(); 
		} else { 
			$('#pagescroll').fadeOut(); 
		} 
	}); 
	$('#pagescroll').click(function(){ 
		$("html, body").animate({ scrollTop: 0 }, 600); 
		return false; 
	}); 
});
</script>

style

<style type="text/css">

h1{font-size:45px;text-align:center; text-decoration:underline;}
h2{font-size:40px;color:#FA0530}
p{font-size:40px;}

#pagescroll {
position:fixed;
right:12px;
bottom:12px;
cursor:pointer;
width:60px;
height:60px;
background-color:#3498db;
text-indent:-9999px;
display:none;
-webkit-border-radius:50px;
-moz-border-radius:50px;
border-radius:50px
}
#pagescroll span {
position:absolute;
top:50%;
left:50%;
margin-left:-9px;
margin-top:-13px;
height:0;
width:0;
border:10px solid transparent;
border-bottom-color:#D3D3D3
}
#pagescroll:hover {
background-color:#F5f6e6;
opacity:1;filter:"alpha(opacity=100)";
-ms-filter:"alpha(opacity=100)";}
</style>

index.html

<body>
<!-- BackToTop Button -->
<a href="#" id="pagescroll" title="pagescroll to Top" style="display: none;">Top<span></span></a>

<h2>About Pakainfo.com – About Us</h2>
<br/>
<p>Welcome to Pakainfo.com – a blog my technologies blogs where you will learn about some Tips, Tricks and More…</p>
<p>In other words means other sens to say, it is a community type of new experiment and research or demo with example in It World (pakainfo).</p>
<p>Pakainfo.com was founded in april, 2019 with the aim of all kind of sharing a place for some Tips, some about it related Tricks and Other very dificult Informer articles or new information for it technologies,tutorials and related solutions very expert level high solution in easy and simplified way that more helps our some Tricks and Tips community including like as Windows and server like as a linux and OS,Google,Google Adsense ,Fiver ,Upwork and How to Make Money Easy way to get basic ideas, learning and understandings.</p>
<p>This blog offers wide range of Tricks and Tips topics including Google, Google Adsense, How to Earn Money using Blogger or Website, Fiver and many more.</p>
<p>Pakainfo.com is the right blog for anyone who is passionate about Earn or Make Money To Home without any InvestMent<br />
of Tips and Tricks methodology.So, grab the opportunity and start learning today!</p>
<br/><br/>
<h3>Why Pakainfo.com?</h3>
<br/>
<ul>
<li>Tremendous Opportunity for Growth</li>
<li>Equal Opportunity Every Person</li>
<li>Earn or Make Money To Home without any InvestMent</li>
<li>Open to New and Innovative Ideas</li>
</ul>
<br/><br/>
<p><b>pakainfo – Goal</b></p>
<br/>
<p style="text-align: justify;">Hello! I am angular king and pakainfo is my web technologies blog. My specialities are Vuejs,API,angularjs,Vuejs,PHP, API, jQuery,Earn money,HTML,CSS eCommerce,JS,Laravel, CMS and bespoke web application development.</p>
<br/><br/>
<p><b>pakainfo says</b></p>
<br/>
<p>We are Web Technology Experts and Team who provide you very Important information on Web Development information, Interview Questions and Answers, live project problem solution and their solution and online free tutorials – “Pakainfo.com”.</p>
<p><a href="https://pakainfo.com/" target="_blank" title="pakainfo" alt="pakainfo" class="download">Live Site</a></p>
</body>

Full Source Code : Example custom bootstrap back to top arrow

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Back To Top Button by Pakainfo.com</title>
<script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type='text/javascript'>
$(document).ready(function(){ 
	$(window).scroll(function(){ 
		if ($(this).scrollTop() > 100) { 
			$('#pagescroll').fadeIn(); 
		} else { 
			$('#pagescroll').fadeOut(); 
		} 
	}); 
	$('#pagescroll').click(function(){ 
		$("html, body").animate({ scrollTop: 0 }, 600); 
		return false; 
	}); 
});
</script>
<style type="text/css">

h1{font-size:45px;text-align:center; text-decoration:underline;}
h2{font-size:40px;color:#FA0530}
p{font-size:40px;}

#pagescroll {
position:fixed;
right:10px;
bottom:10px;
cursor:pointer;
width:50px;
height:50px;
background-color:#3498db;
text-indent:-9999px;
display:none;
-webkit-border-radius:60px;
-moz-border-radius:60px;
border-radius:60px
}
#pagescroll span {
position:absolute;
top:50%;
left:50%;
margin-left:-8px;
margin-top:-12px;
height:0;
width:0;
border:9px solid transparent;
border-bottom-color:#ffffff
}
#pagescroll:hover {
background-color:#e74c3c;
opacity:1;filter:"alpha(opacity=100)";
-ms-filter:"alpha(opacity=100)";}
</style>

</head>

<body>
<!-- BackToTop Button -->
<a href="#" id="pagescroll" title="pagescroll to Top" style="display: none;">Top<span></span></a>

<h2>About Pakainfo.com – About Us</h2>
<br/>
<p>Welcome to Pakainfo.com – a blog my technologies blogs where you will learn about some Tips, Tricks and More…</p>
<p>In other words means other sens to say, it is a community type of new experiment and research or demo with example in It World (pakainfo).</p>
<p>Pakainfo.com was founded in april, 2019 with the aim of all kind of sharing a place for some Tips, some about it related Tricks and Other very dificult Informer articles or new information for it technologies,tutorials and related solutions very expert level high solution in easy and simplified way that more helps our some Tricks and Tips community including like as Windows and server like as a linux and OS,Google,Google Adsense ,Fiver ,Upwork and How to Make Money Easy way to get basic ideas, learning and understandings.</p>
<p>This blog offers wide range of Tricks and Tips topics including Google, Google Adsense, How to Earn Money using Blogger or Website, Fiver and many more.</p>
<p>Pakainfo.com is the right blog for anyone who is passionate about Earn or Make Money To Home without any InvestMent<br />
of Tips and Tricks methodology.So, grab the opportunity and start learning today!</p>
<br/><br/>
<h3>Why Pakainfo.com?</h3>
<br/>
<ul>
<li>Tremendous Opportunity for Growth</li>
<li>Equal Opportunity Every Person</li>
<li>Earn or Make Money To Home without any InvestMent</li>
<li>Open to New and Innovative Ideas</li>
</ul>
<br/><br/>
<p><b>pakainfo – Goal</b></p>
<br/>
<p style="text-align: justify;">Hello! I am angular king and pakainfo is my web technologies blog. My specialities are Vuejs,API,angularjs,Vuejs,PHP, API, jQuery,Earn money,HTML,CSS eCommerce,JS,Laravel, CMS and bespoke web application development.</p>
<br/><br/>
<p><b>pakainfo says</b></p>
<br/>
<p>We are Web Technology Experts and Team who provide you very Important information on Web Development information, Interview Questions and Answers, live project problem solution and their solution and online free tutorials – “Pakainfo.com”.</p>
<p><a href="https://pakainfo.com/" target="_blank" title="pakainfo" alt="pakainfo" class="download">Live Site</a></p>
</body>
</html>

Example

Also Read :  Insert update delete Using Laravel 5.2 Ajax CRUD laravel without refresh page

Example