index.js 635 B

12345678910111213141516171819202122232425
  1. $(function() {
  2. var MainView = Backbone.View.extend({
  3. el: $("div.container"),
  4. modalTemplate: _.template($("#modal-template").html()),
  5. events:{
  6. "click ul.ficons > li": "iconClicked"
  7. },
  8. iconClicked: function(event) {
  9. event.preventDefault();
  10. var $item = $(event.currentTarget);
  11. var $modal = $(this.modalTemplate({"style": $item.find("i").attr("class")}));
  12. $modal.modal("show");
  13. $modal.on('hidden', function () {
  14. $modal.remove();
  15. })
  16. }
  17. });
  18. var mainView = new MainView();
  19. });