javascript - Fancybox is getting the content size wrong when using jQuery-Chosen? -


i have fancybox popup uses ajax fetch content.

the fetched html div, containing title, table input fields, , buttons.

problem is, i'm getting padding, or small size; anyways have unnecessary scrollbars. can disable them using css's overflow, or fancybox's scrolling property, don't want them disabled - added when necessary.

i'm using jquery chosen plugin, what's causing overflow; how can avoid this?

the div content modified client, can add/remove rows dynamically - need scrollbars appear in case user adds many rows fit on screen. here's happens far:

scrollbars

what's wrong this? here's css thing:

#filter-form {     width: 550px; } #filter-form h2 {     text-align: center; } #filter-form .chzn-results {     max-height: 110px; } #filter-form .buttons {     margin-top: 10px;     overflow: hidden; } #filter-form .buttons .btn_save_filter {     float: right; } #assoc-num, #assoc-string {     display: none; }  #filter-form #customuserfilters_title {     width: 350px;     display: block;     margin: 0 auto 30px; } #add-new-row td {     text-align: right; } #add-new-row button {     display: inline; } #filter-rules, #filter-form .buttons {     width: 500px;     margin: 0 auto; } #filter-rules td {     width: 25% !important; } 

the width settings don't matter - removing them or increasing them both still cause them - it's not fancybox's autosize feature that's thinking content smaller -- resizes amount needs, minus pixels cause overflow.

here's html (big mess, know):

<div id="filter-div"> <form action="/customuserfilters/create" id="filter-form"> <h2>create filter</h2> <input placeholder="filter name" type="text" value="" name="customuserfilters[title]" id="customuserfilters_title"><table id="filter-rules">     <tbody><tr class="filter-row"> <td class="td-bool-op"></td> <td class="td-field-id"><select id="" style="width: 150px;" name="customuserfiltersettings[][field_id]"> <option value="2">name</option> </select></td> <td class="td-assoc"><select style="width: 100px;" name="customuserfiltersettings[][assoc]"> <option value="=">=</option> </select></td> <td class="td-value"><input type="text" value="" name="customuserfiltersettings[][value]" id="customuserfiltersettings_value"></td></tr>    <tr id="new-filter">  <td class="td-bool-op"><select id="" style="width: 60px;" name="customuserfiltersettings[][bool_op]"> <option value="and" selected="selected">and</option> <option value="or">or</option> </select></td> <td class="td-field-id"><select id="" style="width: 150px;" name="customuserfiltersettings[][field_id]"> <option value="2">name</option> </select></td> <td class="td-assoc"><select style="width: 100px;" name="customuserfiltersettings[][assoc]"> <option value="=">=</option> </select></td> <td class="td-value"><input type="text" value="" name="customuserfiltersettings[][value]" id="customuserfiltersettings_value"></td>    </tr>     <tr id="add-new-row">         <td colspan="4">             <button id="add-new-row-button" class="btn_grey" name="yt0" type="button">+ add condition</button>        </td>     </tr> </tbody></table> <div class="buttons">     <button class="btn_orange btn_save_filter" name="yt1" type="button">create filter</button>    <button class="btn_grey btn_cancel_filter" name="yt2" type="button">← cancel</button></div> </form> 

and here's fancybox init:

$('#new_filter_button').fancybox({     beforeload: function() {         $('.qtip').hide();     },     type: 'ajax',     href: window.baseurl + '/customuserfilters/create',     openeffect: 'fade',     closeeffect: 'fade',     wrapcss: 'filters-box' }); 

well, turns out, fancybox hides overflowing content.

since using jquery chosen plugin, when boxes closed, containers still in page hidden - caused div higher should, reason fancybox didn't cause dialog bigger, because dropdown hidden, reason excluded out of height although still taking vertical space. horizontal scrollbar took width dialog , caused width overflow, caused vertical scrollbar.

damn! answer other people running problem


Comments

Popular posts from this blog

c++ - Linked List error when inserting for the last time -

java - activate/deactivate sonar maven plugin by profile? -

java - What is the difference between String. and String.this. ? -