Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Got some problems after using "ui boxer"

Demo: http://jsfiddle.net/8jS6d/

I have modified a little bit of it, but I want to know further about this plugin. (I knew some jQuery usages.)

  1. I found out the function widget has a lot of methods, can you tell me which one is the "reserve words"? How about ui-boxer and ui-boxer-disabled ?

  2. Is it possible to add a name (the text inside the div) on every div after creating? I've tried many times, but it did not work. (I don't want all divs to have the same name). For example: create first div which has innerHTML set to 'div-1', second div with innerHTML set to 'div-2' and etc. (see this example)

Is it here where I should modify?

$('#test').boxer({
  stop: function(event, ui) {
    var offset = ui.box.offset();
    ui.box.css({ border: '1px solid white', background: '#EEEEEE' });
    // here?
  }
});

Hope you can help me, I got this plugin without any documentation, so I am confused. (I forgot who is the author too)

like image 446
Baozi Wu Avatar asked Aug 27 '26 16:08

Baozi Wu


1 Answers

Q1. I do not understand what you are asking. Do you mean "reserved words"? The ones you mention are simply class names applied to the element you connect boxer to. What is your concern with those names?

Q2. Your JSFiddle seems to be very close to what you wanted. The example below does what you seem to be asking, by using a classname for the added elements and counting those elements to get the next number.

  // Using the boxer plugin
  $('#test').boxer({
    stop: function(event, ui) {
      //var offset = ui.box.offset();
      ui.box.css({ border: '1px solid white', background: '#EEEEEE' });
      ui.box.addClass("newdiv");
      ui.box.append("div-" + $('.newdiv').length);
    }
  });

http://jsfiddle.net/8jS6d/1/

If this is not what you wanted, please clarify your problem.

like image 102
Gone Coding Avatar answered Aug 30 '26 04:08

Gone Coding



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!