javascript - How to set the table width to parent div width in wordpress widget -


I am writing a plugin for WordPress and use a table layout in the widget wrapper to display rankings and game schedules. I am doing A line with all the information given is used in approximately 1000 pix width for a widget with a width of 260px or 360px, I want to leave less important information to display the most important information in a row. Due to interchangeable themes in WordPress, I do not know how many widgets will be in WordPress.
and examples of my current theme, based on the available width, I want to display more or fewer columns to fill the row. My idea is to first set the width of the table in the inner width of the wrapping divis, that I can do this with something like

  $ ('# objects'). Width ($ ('# Object') .Parent (.) Width ()); Second, it is my goal that to display some columns per line, depending on the width of the row  

My questions:

  • Is my planned way of accomplishing this by sending the width of the table as the parameter of the javascript function? Is there a better way to do this in WordPress? Perhaps someone has solved this before ... but I did not find it ..
  • What is the best practice for nest above jQuery in my code?

    All of my code can be found on.

    Correct me if I am wrong, but width will not be 100% Whatever you are trying to do in CSS, it should always take the breadth of the basic element.

      table {width: 100%; }  

    I think I have not found any relevant information here.


Comments