Skip to content

Instantly share code, notes, and snippets.

@arush
Created August 2, 2011 07:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save arush/1119731 to your computer and use it in GitHub Desktop.
Floating div based on scrollpoint
loadPCROverlay: function () {
try {
var f = ta.id("CHECK_RATE");
var h = ta.id("PERSISTENT_CHECK_RATES_CONTENT");
var d = window.getScroll();
if (!h) {
return
}
if (!f || !d) {
h.dispose();
return
}
ta.store("pcr.scrollPoint", f.getPosition().y);
var j = false;
if (d.y >= ta.retrieve("pcr.scrollPoint")) {
j = true
}
var g = h.get("html");
h.dispose();
ta.store("pcr.overlay", new ta.overlays.AbsoluteOverlay({
toWindow: false,
autoShow: j,
positionType: "fixed",
permanent: true,
zIndex: "9996",
style: "persistentCR",
content: g,
onClose: function () {
ta.store("pcr.keepHidden", true);
Cookie.writeSession("CPCR", 1);
new Request({
url: "/ActionRecord?action=persistent_cr_close"
}).send()
}
}));
window.removeEvent("scroll", ta.overlays.Factory.loadPCROverlay);
window.addEvent("scroll", ta.commerce.checkrates.positionCheckRates)
} catch (i) {
window.removeEvent("scroll", ta.overlays.Factory.loadPCROverlay);
ta.util.error.record(i, "pcr - scroll init");
return false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment