javascript - Sticky Note (Post-it) - change size and keep in browser memory -


i have 2 problems sticky notes wrote in js , jquery.

jsfiddle demo

  1. i using sticky note write data. when want change size, inside field changing size? doing wrong?

  2. i try keep note in browser memory when unfortunately refresh page.

code

var arr = []; $(document).ready(function() {   function limittextarealine(e) {     if (e.keycode == 13 && $(this).val().split("\n").length >= $(this).attr('rows')) {       return false;     }   }   $(function() {     $('textarea.limited').keydown(limittextarealine);   });   var x = "<div class='darkyellow'><span class='close ui-icon ui-icon-close' onclick='closeit($(this));'>x</span>note<div class='lightyellow'><textarea class='notatka' id='user' maxlength='250' rows='8' cols='25' class='limited'></textarea></div></div>";   $('#click').click(function() {     var count = $('.note').length + 1;     $('.note').removeclass('active');     $('#one').append('<div class="note ' + count + ' active">' + x + '</div>');     arr.push(count);     $(".darkyellow").draggable();   });   $('body').click(function(e) {     var target = $(e.target);     if (target.parents('.note').length > 0) {       $('.note').removeclass('active');       target.parents('.note').addclass('active');     }     console.log(arr);   });   $(document).keyup(function(e) {     if (e.keycode == 27) {       if ($('.note').length > 0) {         if ($('.note.active').length > 0) {           var cls = parseint($('.note.active').attr('class').split(' ')[1]);           var index = arr.indexof(cls);           console.log('.note.active.' + cls + ' ' + index);           arr.splice(index, 1);           $('.note.active').remove();         } else {           var cls = math.max.apply(math, arr);           var index = arr.indexof(cls);           arr.splice(index, 1);           console.log('.note.' + cls + ' ' + index);           $('.note.' + cls).remove();         }       }       console.log(arr)     }   }); });  function closeit(that) {   var cls = parseint(that.parent().parent().attr('class').split(' ')[1]);   var index = arr.indexof(cls);   console.log('.note.' + cls + ' ' + index);   arr.splice(index, 1);   that.parent().parent().remove();   localstorage.setitem('var', car); } 


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -