sample.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <!DOCTYPE html>
  2. <!--suppress CssUnusedSymbol, JSUnresolvedLibraryURL -->
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8"/>
  6. <title>Krajee JQuery Plugins - &copy; Kartik</title>
  7. <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  8. <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
  9. <link rel="stylesheet" href="../css/star-rating.css" media="all" type="text/css"/>
  10. <link rel="stylesheet" href="../css/themes/krajee-fa/theme.css" media="all" type="text/css"/>
  11. <link rel="stylesheet" href="../css/themes/krajee-svg/theme.css" media="all" type="text/css"/>
  12. <link rel="stylesheet" href="../css/themes/krajee-uni/theme.css" media="all" type="text/css"/>
  13. <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
  14. <script src="../js/star-rating.js" type="text/javascript"></script>
  15. <script src="../js/themes/krajee-fa/theme.js" type="text/javascript"></script>
  16. <script src="../js/themes/krajee-svg/theme.js" type="text/javascript"></script>
  17. <script src="../js/themes/krajee-uni/theme.js" type="text/javascript"></script>
  18. <body>
  19. <div class="container">
  20. <div class="page-header">
  21. <h2>Bootstrap Star Rating Examples
  22. <small>&copy; Kartik Visweswaran, Krajee.com</small>
  23. </h2>
  24. </div>
  25. <form>
  26. <div class="page-header">
  27. <h3>Glyphicon Star LTR</h3>
  28. </div>
  29. <input type="text" class="rating rating-loading" value="3.75" data-size="xl" title="">
  30. <br>
  31. <input type="text" class="rating rating-loading" value="2.5" data-size="lg" title="">
  32. <br>
  33. <input type="text" class="rating rating-loading" value="1.75" data-size="md" title="">
  34. <br>
  35. <input type="text" class="rating rating-loading" value="4" data-size="sm" title="">
  36. <br>
  37. <input type="text" class="rating rating-loading" value="2" data-size="xs" title="">
  38. <br>
  39. <div class="page-header">
  40. <h3>Glyphicon Star RTL</h3>
  41. </div>
  42. <input type="text" class="kv-gly-star rating-loading" value="3.75" dir="rtl" data-size="xl" title="">
  43. <div class="clearfix"></div>
  44. <br>
  45. <input type="text" class="kv-gly-star rating-loading" value="2.5" dir="rtl" data-size="lg" title="">
  46. <div class="clearfix"></div>
  47. <br>
  48. <input type="text" class="kv-gly-star rating-loading" value="1.75" dir="rtl" data-size="md" title="">
  49. <div class="clearfix"></div>
  50. <br>
  51. <input type="text" class="kv-gly-star rating-loading" value="4" dir="rtl" data-size="sm" title="">
  52. <div class="clearfix"></div>
  53. <br>
  54. <input type="text" class="kv-gly-star rating-loading" value="2" dir="rtl" data-size="xs"
  55. title="">
  56. <div class="clearfix"></div>
  57. <br>
  58. <div class="page-header">
  59. <h3>Glyphicon Heart LTR</h3>
  60. </div>
  61. <input type="text" class="kv-gly-heart rating-loading" value="3.75" data-size="xl" title="">
  62. <br>
  63. <input type="text" class="kv-gly-heart rating-loading" value="2.5" data-size="lg" title="">
  64. <br>
  65. <input type="text" class="kv-gly-heart rating-loading" value="1.75" data-size="md" title="">
  66. <br>
  67. <input type="text" class="kv-gly-heart rating-loading" value="4" data-size="sm" title="">
  68. <br>
  69. <input type="text" class="kv-gly-heart rating-loading" value="2" data-size="xs" title="">
  70. <br>
  71. <div class="page-header">
  72. <h3>Glyphicon Heart RTL</h3>
  73. </div>
  74. <input type="text" class="kv-gly-heart rating-loading" value="3.75" dir="rtl" data-size="xl" title="">
  75. <div class="clearfix"></div>
  76. <br>
  77. <input type="text" class="kv-gly-heart rating-loading" value="2.5" dir="rtl" data-size="lg" title="">
  78. <div class="clearfix"></div>
  79. <br>
  80. <input type="text" class="kv-gly-heart rating-loading" value="1.75" dir="rtl" data-size="md" title="">
  81. <div class="clearfix"></div>
  82. <br>
  83. <input type="text" class="kv-gly-heart rating-loading" value="4" dir="rtl" data-size="sm" title="">
  84. <div class="clearfix"></div>
  85. <br>
  86. <input type="text" class="kv-gly-heart rating-loading" value="2" dir="rtl" data-size="xs" title="">
  87. <div class="clearfix"></div>
  88. <br>
  89. <div class="page-header">
  90. <h3>Unicode Star LTR</h3>
  91. </div>
  92. <input type="text" class="kv-uni-star rating-loading" value="3.75" data-size="xl" title="">
  93. <br>
  94. <input type="text" class="kv-uni-star rating-loading" value="2.5" data-size="lg" title="">
  95. <br>
  96. <input type="text" class="kv-uni-star rating-loading" value="1.75" data-size="md" title="">
  97. <br>
  98. <input type="text" class="kv-uni-star rating-loading" value="4" data-size="sm" title="">
  99. <br>
  100. <input type="text" class="kv-uni-star rating-loading" value="2" data-size="xs" title="">
  101. <br>
  102. <div class="page-header">
  103. <h3>Unicode Star RTL</h3>
  104. </div>
  105. <input type="text" class="kv-uni-star rating-loading" value="3.75" dir="rtl" data-size="xl" title="">
  106. <div class="clearfix"></div>
  107. <br>
  108. <input type="text" class="kv-uni-star rating-loading" value="2.5" dir="rtl" data-size="lg" title="">
  109. <div class="clearfix"></div>
  110. <br>
  111. <input type="text" class="kv-uni-star rating-loading" value="1.75" dir="rtl" data-size="md" title="">
  112. <div class="clearfix"></div>
  113. <br>
  114. <input type="text" class="kv-uni-star rating-loading" value="4" dir="rtl" data-size="sm" title="">
  115. <div class="clearfix"></div>
  116. <br>
  117. <input type="text" class="kv-uni-star rating-loading" value="2" dir="rtl" data-size="xs" title="">
  118. <div class="clearfix"></div>
  119. <br>
  120. <div class="page-header">
  121. <h3>Unicode Rook LTR</h3>
  122. </div>
  123. <input type="text" class="kv-uni-rook rating-loading" value="3.75" data-size="xl" title="">
  124. <br>
  125. <input type="text" class="kv-uni-rook rating-loading" value="2.5" data-size="lg" title="">
  126. <br>
  127. <input type="text" class="kv-uni-rook rating-loading" value="1.75" data-size="md" title="">
  128. <br>
  129. <input type="text" class="kv-uni-rook rating-loading" value="4" data-size="sm" title="">
  130. <br>
  131. <input type="text" class="kv-uni-rook rating-loading" value="2" data-size="xs" title="">
  132. <br>
  133. <div class="page-header">
  134. <h3>Unicode Rook RTL</h3>
  135. </div>
  136. <input type="text" class="kv-uni-rook rating-loading" value="3.75" dir="rtl" data-size="xl" title="">
  137. <div class="clearfix"></div>
  138. <br>
  139. <input type="text" class="kv-uni-rook rating-loading" value="2.5" dir="rtl" data-size="lg" title="">
  140. <div class="clearfix"></div>
  141. <br>
  142. <input type="text" class="kv-uni-rook rating-loading" value="1.75" dir="rtl" data-size="md" title="">
  143. <div class="clearfix"></div>
  144. <br>
  145. <input type="text" class="kv-uni-rook rating-loading" value="4" dir="rtl" data-size="sm" title="">
  146. <div class="clearfix"></div>
  147. <br>
  148. <input type="text" class="kv-uni-rook rating-loading" value="2" dir="rtl" data-size="xs" title="">
  149. <div class="clearfix"></div>
  150. <br>
  151. <div class="page-header">
  152. <h3>Font Awesome Star LTR</h3>
  153. </div>
  154. <input type="text" class="kv-fa rating-loading" value="3.75" data-size="xl" title="">
  155. <br>
  156. <input type="text" class="kv-fa rating-loading" value="2.5" data-size="lg" title="">
  157. <br>
  158. <input type="text" class="kv-fa rating-loading" value="1.75" data-size="md" title="">
  159. <br>
  160. <input type="text" class="kv-fa rating-loading" value="4" data-size="sm" title="">
  161. <br>
  162. <input type="text" class="kv-fa rating-loading" value="2" data-size="xs" title="">
  163. <br>
  164. <div class="page-header">
  165. <h3>Font Awesome Star RTL</h3>
  166. </div>
  167. <input type="text" class="kv-fa rating-loading" value="3.75" dir="rtl" data-size="xl" title="">
  168. <div class="clearfix"></div>
  169. <br>
  170. <input type="text" class="kv-fa rating-loading" value="2.5" dir="rtl" data-size="lg" title="">
  171. <div class="clearfix"></div>
  172. <br>
  173. <input type="text" class="kv-fa rating-loading" value="1.75" dir="rtl" data-size="md" title="">
  174. <div class="clearfix"></div>
  175. <br>
  176. <input type="text" class="kv-fa rating-loading" value="4" dir="rtl" data-size="sm" title="">
  177. <div class="clearfix"></div>
  178. <br>
  179. <input type="text" class="kv-fa rating-loading" value="2" dir="rtl" data-size="xs" title="">
  180. <div class="clearfix"></div>
  181. <br>
  182. <div class="page-header">
  183. <h3>Font Awesome Heart LTR</h3>
  184. </div>
  185. <input type="text" class="kv-fa-heart rating-loading" value="3.75" data-size="xl"
  186. title="">
  187. <br>
  188. <input type="text" class="kv-fa-heart rating-loading" value="2.5" data-size="lg" title="">
  189. <br>
  190. <input type="text" class="kv-fa-heart rating-loading" value="1.75" data-size="md" title="">
  191. <br>
  192. <input type="text" class="kv-fa-heart rating-loading" value="4" data-size="sm" title="">
  193. <br>
  194. <input type="text" class="kv-fa-heart rating-loading" value="2" data-size="xs" title="">
  195. <br>
  196. <div class="page-header">
  197. <h3>Font Awesome Heart RTL</h3>
  198. </div>
  199. <input type="text" class="kv-fa-heart rating-loading" value="3.75" dir="rtl" data-size="xl" title="">
  200. <div class="clearfix"></div>
  201. <br>
  202. <input type="text" class="kv-fa-heart rating-loading" value="2.5" dir="rtl" data-size="lg" title="">
  203. <div class="clearfix"></div>
  204. <br>
  205. <input type="text" class="kv-fa-heart rating-loading" value="1.75" dir="rtl" data-size="md" title="">
  206. <div class="clearfix"></div>
  207. <br>
  208. <input type="text" class="kv-fa-heart rating-loading" value="4" dir="rtl" data-size="sm" title="">
  209. <div class="clearfix"></div>
  210. <br>
  211. <input type="text" class="kv-fa-heart rating-loading" value="2" dir="rtl" data-size="xs" title="">
  212. <div class="clearfix"></div>
  213. <br>
  214. <div class="page-header">
  215. <h3>SVG LTR Star</h3>
  216. </div>
  217. <input type="text" class="kv-svg rating-loading" value="3.75" data-size="xl" title="">
  218. <br>
  219. <input type="text" class="kv-svg rating-loading" value="2.5" data-size="lg" title="">
  220. <br>
  221. <input type="text" class="kv-svg rating-loading" value="1.75" data-size="md" title="">
  222. <br>
  223. <input type="text" class="kv-svg rating-loading" value="4" data-size="sm" title="">
  224. <br>
  225. <input type="text" class="kv-svg rating-loading" value="2" data-size="xs" title="">
  226. <br>
  227. <div class="page-header">
  228. <h3>SVG RTL Star</h3>
  229. </div>
  230. <input type="text" class="kv-svg rating-loading" value="3.75" dir="rtl" data-size="xl" title="">
  231. <div class="clearfix"></div>
  232. <br>
  233. <input type="text" class="kv-svg rating-loading" value="2.5" dir="rtl" data-size="lg" title="">
  234. <div class="clearfix"></div>
  235. <br>
  236. <input type="text" class="kv-svg rating-loading" value="1.75" dir="rtl" data-size="md" title="">
  237. <div class="clearfix"></div>
  238. <br>
  239. <input type="text" class="kv-svg rating-loading" value="4" dir="rtl" data-size="sm" title="">
  240. <div class="clearfix"></div>
  241. <br>
  242. <input type="text" class="kv-svg rating-loading" value="2" dir="rtl" data-size="xs" title="">
  243. <div class="clearfix"></div>
  244. <br>
  245. <div class="page-header">
  246. <h3>SVG LTR Heart</h3>
  247. </div>
  248. <input type="text" class="kv-svg-heart rating-loading" value="3.75" data-size="xl" title="">
  249. <br>
  250. <input type="text" class="kv-svg-heart rating-loading" value="2.5" data-size="lg" title="">
  251. <br>
  252. <input type="text" class="kv-svg-heart rating-loading" value="1.75" data-size="md" title="">
  253. <br>
  254. <input type="text" class="kv-svg-heart rating-loading" value="4" data-size="sm" title="">
  255. <br>
  256. <input type="text" class="kv-svg-heart rating-loading" value="2" data-size="xs" title="">
  257. <br>
  258. <div class="page-header">
  259. <h3>SVG RTL Heart</h3>
  260. </div>
  261. <input type="text" class="kv-svg-heart rating-loading" value="3.75" dir="rtl" data-size="xl" title="">
  262. <div class="clearfix"></div>
  263. <br>
  264. <input type="text" class="kv-svg-heart rating-loading" value="2.5" dir="rtl" data-size="lg" title="">
  265. <div class="clearfix"></div>
  266. <br>
  267. <input type="text" class="kv-svg-heart rating-loading" value="1.75" dir="rtl" data-size="md" title="">
  268. <div class="clearfix"></div>
  269. <br>
  270. <input type="text" class="kv-svg-heart rating-loading" value="4" dir="rtl" data-size="sm" title="">
  271. <div class="clearfix"></div>
  272. <br>
  273. <input type="text" class="kv-svg-heart rating-loading" value="2" dir="rtl" data-size="xs" title="">
  274. <div class="clearfix"></div>
  275. <br>
  276. </form>
  277. </div>
  278. </body>
  279. <script>
  280. $(document).on('ready', function () {
  281. $('.kv-gly-star').rating({
  282. containerClass: 'is-star'
  283. });
  284. $('.kv-gly-heart').rating({
  285. containerClass: 'is-heart',
  286. defaultCaption: '{rating} hearts',
  287. starCaptions: function (rating) {
  288. return rating == 1 ? 'One heart' : rating + ' hearts';
  289. },
  290. filledStar: '<i class="glyphicon glyphicon-heart"></i>',
  291. emptyStar: '<i class="glyphicon glyphicon-heart-empty"></i>'
  292. });
  293. $('.kv-fa').rating({
  294. theme: 'krajee-fa',
  295. filledStar: '<i class="fa fa-star"></i>',
  296. emptyStar: '<i class="fa fa-star-o"></i>'
  297. });
  298. $('.kv-fa-heart').rating({
  299. defaultCaption: '{rating} hearts',
  300. starCaptions: function (rating) {
  301. return rating == 1 ? 'One heart' : rating + ' hearts';
  302. },
  303. theme: 'krajee-fa',
  304. filledStar: '<i class="fa fa-heart"></i>',
  305. emptyStar: '<i class="fa fa-heart-o"></i>'
  306. });
  307. $('.kv-uni-star').rating({
  308. theme: 'krajee-uni',
  309. filledStar: '&#x2605;',
  310. emptyStar: '&#x2606;'
  311. });
  312. $('.kv-uni-rook').rating({
  313. theme: 'krajee-uni',
  314. defaultCaption: '{rating} rooks',
  315. starCaptions: function (rating) {
  316. return rating == 1 ? 'One rook' : rating + ' rooks';
  317. },
  318. filledStar: '&#9820;',
  319. emptyStar: '&#9814;'
  320. });
  321. $('.kv-svg').rating({
  322. theme: 'krajee-svg',
  323. filledStar: '<span class="krajee-icon krajee-icon-star"></span>',
  324. emptyStar: '<span class="krajee-icon krajee-icon-star"></span>'
  325. });
  326. $('.kv-svg-heart').rating({
  327. theme: 'krajee-svg',
  328. filledStar: '<span class="krajee-icon krajee-icon-heart"></span>',
  329. emptyStar: '<span class="krajee-icon krajee-icon-heart"></span>',
  330. defaultCaption: '{rating} hearts',
  331. starCaptions: function (rating) {
  332. return rating == 1 ? 'One heart' : rating + ' hearts';
  333. },
  334. containerClass: 'is-heart'
  335. });
  336. $('.rating,.kv-gly-star,.kv-gly-heart,.kv-uni-star,.kv-uni-rook,.kv-fa,.kv-fa-heart,.kv-svg,.kv-svg-heart').on(
  337. 'change', function () {
  338. console.log('Rating selected: ' + $(this).val());
  339. });
  340. });
  341. </script>
  342. </html>