treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Javascript / Cookie database With & Height problem

  • Hi,

    I'm currently making memo.js, a jQuery plugin for Chrome-users. With the plugin, users can mark text on a website.

    I create memo.js with cookies, Javascript, CSS and HTML.

    The script remembers the place from the memo, but not the height. I use resize:both; to change the height from the memo, with the standard height and with: 10x70px.

    Could anyone help me with the height and the width, please? I'm a beginning Dutch JS'er.

    Thanks!

    P.S. Here is the link to my project: memo.js (only for Chrome).

  • Yes, that's right. But that was at the wrong forum (CSS)

  • It looks like you're storing the top and left well enough. Perhaps you can store an object for each one:

    {left:100,top:200,width:97,height:200}

    As you're able to store data already, it sounds like you're wondering how to acquire the height and width on resize:

    jQuery('window').on('resize', '.note', function(){
          console.log(this.width());
          console.log(this.height());
    });

    Without digging too much into it, I'm sure that something along these lines will suit you.

    It would be easier to debug if we had a Codepen style example. Let me know how it goes.