"testimonials"
Bootstrap 3.3.0 Snippet by ashutosh123

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div id="carousel-testimonials" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <ol class="carousel-indicators"> <li data-target="#carousel-testimonials" data-slide-to="0" class="active"></li> <li data-target="#carousel-testimonials" data-slide-to="1"></li> </ol> <!-- Wrapper for slides --> <div class="carousel-inner" role="listbox"> <div class="item active"> <div class="caption"> <blockquote> "We are all constructed out of our self dialogue." </blockquote> <small><cite title="Source Title"> <div id="stars-existing" class="starrr" data-rating='4'></div>— BRYANT MCGILL</cite></small> <p>Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum</p> </div> </div> <div class="item"> <div class="caption"> <blockquote> "We are all constructed out of our self dialogue." </blockquote> <small><cite title="Source Title"> <div id="stars-existing" class="starrr" data-rating='4'></div>— BRYANT MCGILL</cite></small> <p>Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum</p> </div> </div> </div> </div>
#carousel-testimonials .carousel-indicators { bottom: inherit; top: 20rem; } #carousel-testimonials .carousel-indicators li{ border :2px solid #7c8a8d; width:16px; height:16px; margin:0px; } #carousel-testimonials .carousel-indicators .active { width: 16px; height: 16px; margin: 0; background-color: #ac1c20; border :2px solid #ac1c20; } #carousel-testimonials .caption blockquote{ font-size:36px; color:#282828; } #carousel-testimonials .caption small cite{ color:#4a4f55; font-size:20px; } #carousel-testimonials .caption #stars-existing{ display:inline-block; font-size:28px; } #carousel-testimonials .caption #stars-existing .glyphicon-star-empty{ color:#ac1c20; } #carousel-testimonials .caption #stars-existing .glyphicon-star{ color:#ac1c20; }
var __slice = [].slice; (function($, window) { var Starrr; Starrr = (function() { Starrr.prototype.defaults = { rating: void 0, numStars: 5, change: function(e, value) {} }; function Starrr($el, options) { var i, _, _ref, _this = this; this.options = $.extend({}, this.defaults, options); this.$el = $el; _ref = this.defaults; for (i in _ref) { _ = _ref[i]; if (this.$el.data(i) != null) { this.options[i] = this.$el.data(i); } } this.createStars(); this.syncRating(); this.$el.on('mouseover.starrr', 'span', function(e) { return _this.syncRating(_this.$el.find('span').index(e.currentTarget) + 1); }); this.$el.on('mouseout.starrr', function() { return _this.syncRating(); }); this.$el.on('click.starrr', 'span', function(e) { return _this.setRating(_this.$el.find('span').index(e.currentTarget) + 1); }); this.$el.on('starrr:change', this.options.change); } Starrr.prototype.createStars = function() { var _i, _ref, _results; _results = []; for (_i = 1, _ref = this.options.numStars; 1 <= _ref ? _i <= _ref : _i >= _ref; 1 <= _ref ? _i++ : _i--) { _results.push(this.$el.append("<span class='glyphicon .glyphicon-star-empty'></span>")); } return _results; }; Starrr.prototype.setRating = function(rating) { if (this.options.rating === rating) { rating = void 0; } this.options.rating = rating; this.syncRating(); return this.$el.trigger('starrr:change', rating); }; Starrr.prototype.syncRating = function(rating) { var i, _i, _j, _ref; rating || (rating = this.options.rating); if (rating) { for (i = _i = 0, _ref = rating - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) { this.$el.find('span').eq(i).removeClass('glyphicon-star-empty').addClass('glyphicon-star'); } } if (rating && rating < 5) { for (i = _j = rating; rating <= 4 ? _j <= 4 : _j >= 4; i = rating <= 4 ? ++_j : --_j) { this.$el.find('span').eq(i).removeClass('glyphicon-star').addClass('glyphicon-star-empty'); } } if (!rating) { return this.$el.find('span').removeClass('glyphicon-star').addClass('glyphicon-star-empty'); } }; return Starrr; })(); return $.fn.extend({ starrr: function() { var args, option; option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; return this.each(function() { var data; data = $(this).data('star-rating'); if (!data) { $(this).data('star-rating', (data = new Starrr($(this), option))); } if (typeof option === 'string') { return data[option].apply(data, args); } }); } }); })(window.jQuery, window); $(function() { return $(".starrr").starrr(); }); $( document ).ready(function() { $('#stars').on('starrr:change', function(e, value){ $('#count').html(value); }); $('#stars-existing').on('starrr:change', function(e, value){ $('#count-existing').html(value); }); });

Related: See More


Questions / Comments: