Add Animated Scroll to Top Button in WordPress


Add Animated Scroll to Top Button in WordPress

Add Animated Scroll to Top Button in WordPress now a days Blog Owner Loves to add Responsive Animation Addon’s to attract their website visitor’s in this tutorial we are going to see About How to add an Animated Scroll to Top Button in WordPress site without plugins this scroll to Top Button build with HTML/CSS and jQuery.

Add Animated Scroll to Top Button in WordPress Without using Plugin

Demo Screenshot (Tested in Twenty Fifteen WordPress theme)

Add Animated Scroll to Top Button in WordPress

 

<div class="scroll-top">

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAAA3NCSVQICAjb4U/gAAAACXBIWXMAADgxAAA4MQFS6poDAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAArVQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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yNMtwGiLEQXke9BNDFd9GKo+CUzRIZCtNDFRoiSb5hhGlTMY6Y5ELV0cQ9EHTP9HiqeZaY9EH2P01F4AEQrMz0LFa/RxjUQi+noJYhh55npH1CxnTZehBh2jk6uglhAG1uh4ghthCogmulgPUTRMdr4DAoKu2mnAaKKDiZD/Ip2zkBBEW19WgDxNrP6EIYttNNdAAVf01YtxM3M6i6IKto6ChUf09Z/IAIHmMWxYogXaGs3VLxFW9HREDOZxaMQFSHaegMqXqG9RoiLvqat0CCIh2nvRah4inbCjeUwPE5bf4WhbFEX7TwBFQ3MFG0egZghZ2kjehlihq7oZqbfQsU0ZjhWjYQm2liHhGvameF2qBjJdHuGI+mSG20MR9KQnUw3FEr202pNfyi5aDWt9kLNX2jRHICiwEpa/AlqJjPV5iIoK3qHqa6Dmn4hJh0chBxUHGTS6SIoep0JnaORk9EdTFgHVfczoR6pHjnl4BhSTWfCTKiqpGkDLIJ0EIbFv2gaCWXbGHP6B7AI0kEYFkNOMuY9qBvVSUN4CqyCdBCGVU0XDR0jkIOb2kh2TkKaIB2EkWb8KZL7apCb6vpxRUgXpIMw0hWNq/8ptArSQRj+C9JBGP4L0kEYqv4PRNfN+HEdPF4AAAAASUVORK5CYII=" />

<span class="flame"></span>
<span class="flame"></span>
<span class="flame"></span>
</div>


<style>
.scroll-top img{
height:45px;
margin: -12px 0 0 5px;
border:0;
}

.scroll-top {height: 60px; width: 60px; position: fixed; bottom: 100px; right: 30px; display: none; z-index: 9999;}.scroll-top:hover{animation-delay:0s;animation-duration:.1s;animation-iteration-count:infinite;animation-name:shake-little;animation-play-state:running;animation-timing-function:ease-in-out}.scroll-top .flame{-moz-border-bottom-colors:none;-moz-border-left-colors:none;-moz-border-right-colors:none;-moz-border-top-colors:none;border-color:#ffda44 transparent transparent;border-style:solid;border-width:25px 3px 3px;display:none;height:0;left:-4px;margin:-5px auto 0;position:absolute;right:0;top:66%;width:0}.scroll-top .flame+.flame{border-width:10px 2px 2px;left:20px;margin:0}.scroll-top .flame+.flame+.flame{border-width:10px 2px 2px;left:auto;margin:0;right:24px}.scrolling .flame{display:block}.nav-toggle,.owl-item .quote-icon,.price-box .price-box-head-shadow,.scroll-top .flame{transition:all .5s cubic-bezier(.25,.1,.25,1) 0s}@keyframes shake-little{0%{transform:translate(0,0) rotate(0)}14%,16%,2%,20%,24%,30%,48%,52%,54%,76%,8%,84%,86%,88%,92%,96%,98%{transform:translate(0,0) rotate(-.5deg)}10%,12%,22%,32%,4%,42%,44%,64%,72%,80%,90%{transform:translate(-1px,0) rotate(-.5deg)}18%,34%,36%,46%,6%,66%,68%,70%,74%,82%,94%{transform:translate(0,-1px) rotate(-.5deg)}26%,28%,38%,40%,50%,56%,58%,60%,62%,78%{transform:translate(-1px,-1px) rotate(-.5deg)}}
</style>


<script type="text/javascript">
// Scroll to top button
 wnHeight = jQuery(window).height();
 //Check to see if the window is top if not then display button
 jQuery(window).scroll(function(){
 if (jQuery(this).scrollTop() > wnHeight/2) {
 jQuery('.scroll-top').fadeIn();
 } else {
 jQuery('.scroll-top').fadeOut().removeClass('scrolling');
 }
 });

//Click event to scroll to top
 jQuery('.scroll-top').click(function(){
 jQuery('html, body').animate({scrollTop : 0},800);
 jQuery(this).addClass('scrolling');

});

</script>

  • You can Also add your own Rocket Image Get it From Here Rocket Icons.You can Convert them into Base 64 Format for Fast Loading.check the above script I highlighted with red color replace the Image Url with your Image URL.
  • You can also adjust its positioning by editing the margin CSS Code.

Credits

This Animated Scroll To Top Widget Was developed By Dhiraj Barnwal (allbloggertricks.com)

From the Editor’s Desk

If your Theme having a built-in Scroll to top Button Feature Means Disable it From your theme Option Panel or Contact your Theme developer for Disable the built-in Scroll to top Button and Replace it with the Animated Scroll to Top Button.

If you Need Any Help Please Feel to Comment Here Our team will Help you.


Was this article helpful?
Thanks!

Your feedback helps us improve Allwebtuts.com



10 Shares
+12
Tweet
Share7
Pin1
Stumble