Permalink
Browse files

Add tab hover and close x icon behavior after adding a new tab

  • Loading branch information...
1 parent cea03b1 commit b8d64f9d40265999c23256a6fc8b37506afd6013 @azawawi committed Nov 5, 2012
Showing with 24 additions and 11 deletions.
  1. +24 −11 lib/Farabi6/files/farabi.js
@@ -467,22 +467,35 @@ function startFarabi(editorId) {
}
});
- $(".icon-remove").hover(function() {
- $(this).addClass("icon-remove-sign");
- },
- function() {
- $(this).removeClass("icon-remove-sign");
- });
+
+ var addTabBehavior = function() {
+
+ $(".icon-remove").hover(function() {
+ $(this).addClass("icon-remove-sign");
+ },
+ function() {
+ $(this).removeClass("icon-remove-sign");
+ });
+
+ $('a[data-toggle="tab"]').on('shown', function (e) {
+ //e.target // activated tab
+ //e.relatedTarget // previous tab
+ alert("TODO implement editor tab selection");
+ });
+
+
+ $(".icon-remove").on('click', function() {
+ $(this).parent().remove();
+ });
+ };
+
+ addTabBehavior();
$(".new-file-button").click(function() {
$("#myTab").append('<li><a href="#home" data-toggle="tab">Home&nbsp;&nbsp;<i class="icon-remove"></i></a></li>');
+ addTabBehavior();
});
- $('a[data-toggle="tab"]').on('shown', function (e) {
- //e.target // activated tab
- //e.relatedTarget // previous tab
- alert("TODO implement editor tab selection");
- });
}
function runOnPerlito6(source) {

0 comments on commit b8d64f9

Please sign in to comment.