Bootstrap snippet and html example. Refresh Widget

Bootstrap 3.1.1 snippet "Refresh Widget" with HTML, CSS, and JS. Copy, paste, and customize this responsive UI component for your project.
Tags: Refresh,Widget

HTML code

Clean, semantic HTML that powers this Bootstrap 3.1.1 snippet. Copy and paste it into your page (with Bootstrap loaded) to reproduce the exact layout shown in the preview.

<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">
<div class="container bootstrap snippets bootdey">
    <!--refresh widget-->
        <div class="panel panel-info"> 
            <div class="panel-heading">
            <h1>
            <span class="glyphicon glyphicon-th"></span>
            <a class="refresh pull-right" href="#"><span class="fa fa-refresh"></span></a> <strong>Refresh Widget</strong>
             </h1>    
            </div>
          <div class="panel-body panel-refresh">
         	<div class="refresh-container"><i class="refresh-spinner fa fa-spinner fa-spin fa-5x"></i></div>
            <h4>Refresh Me: Please click on the refresh button </h4>
              <div class="jumbotron"> 
                This widget utilizes the simple <strong>$.refreshMe()</strong> plugin!
              </div>
              <div class="refresh-data"> 
              	This is the original data that will update upon refresh..
              </div>
          </div>
        </div>
    <!--refresh widget-->
</div>

CSS code

Scoped CSS that styles the component. Paste it after Bootstrap 3.1.1 to keep the design, spacing, and responsiveness consistent.

.panel-refresh {
 height:250px;
 position:relative;
}
 
.refresh-container {
 position:absolute;
 top:0;
 right:0;
 background:rgba(200,200,200,0.25);
 width:100%;
 height:100%;
 display: none;
 text-align:center;
 z-index:4;
}
.refresh-spinner {
 padding: 30px;
 opacity: 0.8;
}

Javascript/Jquery code

Lightweight JS to power any interactions this snippet needs. Drop it under your scripts (after Bootstrap 3.1.1) to mirror the live demo.

$.fn.refreshMe = function(opts){
    var $this = this,
        defaults = {
          ms:1500,
          started:function(){},
          completed:function(){}
        },
        settings = $.extend(defaults, opts);
  
	var panelToRefresh = $this.parents('.panel').find('.refresh-container');
  	var dataToRefresh = $this.parents('.panel').find('.refresh-data');
  	var ms = settings.ms;
  	var started = settings.started;		//function before timeout
	var completed = settings.completed;	//function after timeout
    
  	$this.click(function(){
      $this.addClass("fa-spin");
      panelToRefresh.show();
      started(dataToRefresh);
      setTimeout(function(){
          completed(dataToRefresh);
          panelToRefresh.fadeOut(800);
          $this.removeClass("fa-spin");
      },ms);
      return false;
    })
}

$(document).ready(function(){
      
  $('.refresh').refreshMe({
    started:function(ele){ele.html("Getting new data..")},
  	completed:function(ele){ele.html("This is the new data after refresh..")}
  });
}); 

Similar snippets

Bootstrap example and template. Blog image Gallery Widget

Blog image Gallery Widget

Bootstrap example and template. user blog post widget

user blog post widget

Bootstrap example and template. bs4 timeline widget

bs4 timeline widget

Bootstrap example and template. Blog Gallery Widget

Blog Gallery Widget

Bootstrap example and template. bs5 dark footer

bs5 dark footer

Bootstrap example and template. Filter search result page

Filter search result page

Bootstrap example and template. Product comparison

Product comparison

Bootstrap example and template. friend zone user list

friend zone user list

FAQ

How do I use this snippet?

Include Bootstrap 3.1.1, paste the HTML, add the CSS block, and include the JS (if any) to mirror the live preview.

Can I use it in commercial projects?

Yes. It’s free for personal and commercial work; check the snippets license for details.

Is it responsive?

Yes. It inherits the responsive grid and components from Bootstrap 3.1.1.

Bootstrap example and template. Refresh Widget

About this bootstrap example/template

Optimized for copy‑paste: clean HTML, scoped CSS, and minimal JS so you can ship production‑ready UI faster and keep designs consistent.

Mobile‑first and responsive by default. Tested across modern browsers to reduce polish time on your project.

Already trusted in 10.6K+ views. Reuse this snippet to speed up landing pages, dashboards, or onboarding flows.

Bootstrap 3.1.1

<link rel='stylesheet' href='https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css'>

<script src='https://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js'></script>

This code example is based on bootstrap 3.1.1 and the grid system of this framework

Responsive

Based on bootstrap framework makes all the layouts perfectly responsive for all devices

Crossbrowser compatibility

Tested on all major browsers, it works smoothly on all of them

Jquery plugins

Great built-in plugins with jquery framework, you can easy to change all declarations

semantic html 5

Built on html / css3 the code quality is really amazing

Simple Integration

This code example can be simply integrated on existing sites and new ones too, all you need to do is copy the code and start working