From ae4d9172b4ab1a020980eccfc4ade462513b3768 Mon Sep 17 00:00:00 2001 From: emkael Date: Mon, 24 Aug 2015 16:07:10 +0200 Subject: * initial commit --- javas/bidding.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 javas/bidding.js (limited to 'javas/bidding.js') diff --git a/javas/bidding.js b/javas/bidding.js new file mode 100644 index 0000000..5165aa8 --- /dev/null +++ b/javas/bidding.js @@ -0,0 +1,43 @@ +var display_bidding = function(element, bidding) { + var popup = $('
'); + popup.css({ + 'position': 'absolute', + 'width': '250px', + 'left': element.position().left + element.width(), + 'top': element.position().top + }); + popup.html(bidding); + element.after(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'); + } + } + } + ); + return false; +}; + +var bind_bidding_links = function() { + $('a.biddingLink').each(function() { + $(this).unbind('click').click(load_bidding); + }); + $(document).click(function() { + $('#bidding_popup').remove(); + }); +}; + +$(document).ready(function() { + setInterval(bind_bidding_links, 1000); +}); -- cgit v1.2.3