diff options
-rw-r--r-- | res/css/bidding.css | 11 | ||||
-rw-r--r-- | res/javas/bidding.js | 46 |
2 files changed, 24 insertions, 33 deletions
diff --git a/res/css/bidding.css b/res/css/bidding.css index f884979..22e3696 100644 --- a/res/css/bidding.css +++ b/res/css/bidding.css @@ -1,11 +1,6 @@ /* Tabelka licytacji */ -#bidding_popup { background-color: white; padding: 10px; border-radius: 10px; border: 1px solid black; - -webkit-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75); - -moz-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75); - box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75); - z-index: 1000; -} -#bidding_popup table { width: 100%; text-align: center; } -#bidding_popup table th { text-align: center; } +.bidding_popup table { width: 100%; text-align: center; } +.bidding_popup table th { text-align: center; } +.bidding_popup table td { width: 25%; } a.biddingLink { background: white url('../images/link.png') no-repeat; display: inline-block; width: 16px; height: 16px; position: absolute; right: 2px; top: 3px} td.nol {position:relative; min-height: 16px; padding: 2px 21px 2px 2px} diff --git a/res/javas/bidding.js b/res/javas/bidding.js index 5932e66..72a4ec4 100644 --- a/res/javas/bidding.js +++ b/res/javas/bidding.js @@ -1,40 +1,36 @@ var display_bidding = function(element, bidding) { - var popup = $('<div id="bidding_popup"></div>'); - popup.css({ - 'position': 'absolute', - 'width': '250px', - 'left': element.offset().left + element.width(), - 'top': element.offset().top - }); - popup.html(bidding); - $('body').append(popup); + var popup = $('<tr class="bidding_popup"><td class="n"> </td><td class="bidding_cell noc" colspan="1000"></td></tr>'); + popup.find('.bidding_cell').html(bidding); + element.closest('tr').after(popup); + element.data('bidding-row', popup); } var load_bidding = function() { - $('#bidding_popup').remove(); var elem = $(this); - $.ajax( - { - url: elem.attr('data-bidding-link'), - complete: function(xhr, status) { - if (status == 'success') { - display_bidding(elem, xhr.responseText); - } - else { - display_bidding(elem, 'Brak danych'); + if (elem.data('bidding-row')) { + elem.data('bidding-row').remove(); + elem.removeData('bidding-row'); + } else { + $.ajax( + { + url: elem.attr('data-bidding-link'), + complete: function(xhr, status) { + if (status == 'success') { + display_bidding(elem, xhr.responseText); + } + else { + display_bidding(elem, 'Brak danych'); + } } } - } - ); + ); + } return false; }; var bind_bidding_links = function() { $('a.biddingLink').each(function() { - $(this).unbind('click').click(load_bidding); - }); - $(document).click(function() { - $('#bidding_popup').remove(); + $(this).unbind('click').attr('title', 'Pokaż/ukryj licytację').click(load_bidding); }); }; |