Skip to content

Instantly share code, notes, and snippets.

@ridhotegar
Created February 1, 2020 05:14
Show Gist options
  • Save ridhotegar/b7eb51aa3e573eb90024e5e633a856d2 to your computer and use it in GitHub Desktop.
Save ridhotegar/b7eb51aa3e573eb90024e5e633a856d2 to your computer and use it in GitHub Desktop.
Simple OnLoad Loading JQuery CodeIgniter
<!-- loading CSS -->
<style type="text/css">
.preloader {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 9999;
background-color: #fff;
}
.preloader .loading {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
font: 14px arial;
}
</style>
<!-- stop loading -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script>
$(window).load(function() {
$(".preloader").fadeOut();
})
</script>
<!-- run loading -->
<div class="preloader">
<div class="loading">
<img src="<?php echo base_url('asset/img/Loader.gif') ?>" width="80">
<p>
<br>Harap Tunggu</p>
</div>
</div>
<!-- end run loading -->
Call With :
<?php $this->load->view('loading'); ?>
File location :
loading.php on views folder
Custom Call function :
$(".preloader").fadeIn();
Stop function :
$(".preloader").fadeOut();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment