/    Sign up×
Community /Pin to ProfileBookmark

Script like on Amazon.com homepage

The Amazon.com homepage greets visitors with a script that slides an announcement layer into view and then pulls it back up. Does anyone know of a ready-made script that does that?

thanks.

crispy?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliAug 03.2003 — you could copy it from amazon's site ????
Copy linkTweet thisAlerts:
@polaatx2authorAug 04.2003 — Khalid,

I did but can't get it to work. It is so complicated I can't even understand exactly how they do it. Here's the script:

<SCRIPT language=JavaScript1.2>

var agt=navigator.userAgent.toLowerCase();

var is_major = parseInt(navigator.appVersion);

var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)

&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)

&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));

var is_gecko = (agt.indexOf('gecko') != -1);

var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

var is_aol = (agt.indexOf("aol") != -1);

var is_opera = (agt.indexOf("opera") != -1);

var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );

var is_ns4 = document.layers

var is_ns6 = document.getElementById&&!document.all

var is_ie4 = document.all

var is_opr = navigator.userAgent.indexOf("Opera")

var zindex=100

function amz_js_findPosX(obj) {

var curleft = 0;

if (document.getElementById || document.all) {

while (obj.offsetParent) {

curleft += obj.offsetLeft

obj = obj.offsetParent;

}

} else if (document.layers) {

curleft += obj.x;

}

return curleft;

}

function amz_js_findPosY(obj) {

var curtop = 0;

if (document.getElementById || document.all) {

while (obj.offsetParent) {

curtop += obj.offsetTop

obj = obj.offsetParent;

}

} else if (document.layers) {

curtop += obj.y;

}

return curtop;

}

function amz_js_showselect(turnOn) {

if (is_ie4) {

var selects = document.all.tags("SELECT");

for (var i = 0; i < selects.length; i++) {

var thisSelect = selects[i];

var selectLeftPos = amz_js_findPosX(thisSelect);

var selectRightPos = selectLeftPos + thisSelect.offsetWidth;

var selectTopPos = amz_js_findPosY(thisSelect);

var selectBottomPos = selectTopPos + thisSelect.offsetHeight;

var menuLeftPos = amz_js_findPosX(rhh);

var menuRightPos = menuLeftPos + rhh.style.pixelWidth;

var menuTopPos = amz_js_findPosY(rhh);

var menuBottomPos = menuTopPos + 300;

var hideSelect = false;

if ( !( ( selectTopPos > menuBottomPos )

|| ( menuTopPos > selectBottomPos )

|| ( menuLeftPos > selectRightPos )

|| ( selectLeftPos > menuRightPos ) ) ) {

hideSelect = true;

}

if (turnOn || hideSelect) {

thisSelect.style.visibility = turnOn ? "visible" : "hidden";

}

}

}

}

function amz_js_hidemenu(){

if (is_ie&&window.themenu) {

themenuStyle.visibility="hidden";

amz_js_showselect(true);

}

}

function amz_js_dropmenu(e,menuID,xOffset,yOffset){

curmenuID=is_ns6? document.getElementById(menuID).id : eval(menuID).id

if (window.themenu&&themenu.id!=curmenuID) {

themenuStyle.visibility=is_ns4?"hide" : "hidden"

}

themenu=is_ns6? document.getElementById(menuID): eval(menuID)

themenuStyle=(is_ns6||is_ie4)? themenu.style : themenu

themenuoffsetX=(is_ie4&&is_opr==-1)? document.body.scrollLeft : 0

themenuoffsetY=(is_ie4&&is_opr==-1)? document.body.scrollTop : 0

themenuStyle.left=is_ns6||is_ns4? e.pageX-e.layerX+xOffset : themenuoffsetX+event.clientX-event.offsetX+xOffset

themenuStyle.top=is_ns6||is_ns4? e.pageY-e.layerY+yOffset : themenuoffsetY+event.clientY-event.offsetY+yOffset

amz_js_showselect(false);

hiddenconst=(is_ns6||is_ie4)? "hidden" : "hide"

if (themenuStyle.visibility==hiddenconst){

themenuStyle.visibility=(is_ns6||is_ie4)? "visible" : "show"

themenuStyle.zIndex=zindex++

} else {

amz_js_hidemenu();

}

return false;

}

if (is_ie) {

document.onclick=amz_js_hidemenu

}

</SCRIPT>
Copy linkTweet thisAlerts:
@conma2cangAug 20.2003 — has anyone know how to do this yet?
×

Success!

Help @polaatx2 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...