diff --git a/cps/static/js/caliBlur.js b/cps/static/js/caliBlur.js index dab2a1c6..d4c43bcc 100644 --- a/cps/static/js/caliBlur.js +++ b/cps/static/js/caliBlur.js @@ -405,10 +405,35 @@ $("div.comments").readmore({ // Advanced Search Results if($("body.advsearch").length > 0) { + $("#loader + .container-fluid") + .prepend("
"); + $("#add-to-shelves").insertBefore(".blur-wrapper"); $('div[aria-label="Add to shelves"]').click(function () { $("#add-to-shelves").toggle(); }); $('#add-to-shelf').height("40px"); + function dropdownToggle() { + topPos = $("#add-to-shelf").offset().top-20; + if ($('div[aria-label="Add to shelves"]').length > 0) { + + position = $('div[aria-label="Add to shelves"]').offset().left + + if (position + $("#add-to-shelves").width() > $(window).width()) { + positionOff = position + $("#add-to-shelves").width() - $(window).width(); + adsPosition = position - positionOff - 5 + $("#add-to-shelves").attr("style", "left: " + adsPosition + "px !important; right: auto; top: " + topPos + "px"); + } else { + $("#add-to-shelves").attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px"); + } + } + } + + dropdownToggle(); + + $(window).on("resize", function () { + dropdownToggle(); + }); + } // Author Page Background Blur