Created
August 2, 2011 07:10
-
-
Save arush/1119731 to your computer and use it in GitHub Desktop.
Floating div based on scrollpoint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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