Javascript help needed for "floating" image

D

Don Wiss

On my StoreFront pages I've added B&H ads. On my longest page
http://donwiss.com/pictures/BrooklynStores/ you can see a single B&H ad at
the top of the right table column. The page is long. I'd like that ad to
remain in view as the people scroll down.

I found a page doing what I want. I looked at the source code. It is beyond
me to understand it. Based on the image size it would appear to be in this
code:

<div id="bnslsp3" style="height: 600px; width: 160px; display: block;
padding-left: 3px;">
<!-- BEGIN RAW TAG - 160 x 600 - ROS: Run-of-site - DO NOT MODIFY -->
<IFRAME name="bnr3" id="bnr3" style="position: absolute; z-index: 10;"
FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=160
HEIGHT=614 SRC="http://www.demonoid.com/cached/cpxr_pab.php"></IFRAME>
<!-- END TAG cpxr. -->
</div><script language="JavaScript" type="text/javascript">
<!-- start opera fix
if(navigator.userAgent.indexOf("Opera")!=-1){

setTimeout('Scrollinit();',1500);
}
// -->
</script></td></tr></table></div>

[end of code excerpt]

How would I adapt that to my needs?

Don <www.donwiss.com> (e-mail link at home page bottom).
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Wed, 26 Sep 2007 16:19:18
GMT Don Wiss scribed:
On my StoreFront pages I've added B&H ads. On my longest page
http://donwiss.com/pictures/BrooklynStores/ you can see a single B&H
ad at the top of the right table column. The page is long. I'd like
that ad to remain in view as the people scroll down.

I found a page doing what I want. I looked at the source code. It is
beyond me to understand it. Based on the image size it would appear to
be in this code:

..snip

How would I adapt that to my needs?

What you're really talking about is the css styling "position:fixed;"
Javascript can be used to emulate this, particularly in ie6 where the css
designation doesn't work. However, the example you gave is completely
bogus, and using javascript for the purpose isn't a particularly good idea,
anyway, especially if you don't understand how it operates or the
ramifications thereto related.
 
D

Don Wiss

Well bust mah britches and call me cheeky, on Wed, 26 Sep 2007 16:19:18
GMT Don Wiss scribed:


What you're really talking about is the css styling "position:fixed;"
Javascript can be used to emulate this, particularly in ie6 where the css
designation doesn't work. However, the example you gave is completely
bogus, and using javascript for the purpose isn't a particularly good idea,
anyway, especially if you don't understand how it operates or the
ramifications thereto related.

Demonoid has come back up. Here is an example of what I want to do;
http://www.demonoid.com/files/?category=2&subcategory=0&quality=62&seeded=0&external=2&query=&uid=0
However, in Firefox the ad does not appear. In IE7 you can see it working
the way I want. So I guess the code will have to detect the browser and for
Firefox, if it can't remain visible, then to revert back to a single ad at
the top.

All this is beyond me, and if necessary I'll hire someone to do it.

Don <www.donwiss.com> (e-mail link at home page bottom).
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Sun, 30 Sep 2007 17:52:44
GMT Don Wiss scribed:
Demonoid has come back up. Here is an example of what I want to do;
http://www.demonoid.com/files/?category=2&subcategory=0&quality=62&seed
ed=0&external=2&query=&uid=0 However, in Firefox the ad does not
appear. In IE7 you can see it working the way I want. So I guess the
code will have to detect the browser and for Firefox, if it can't
remain visible, then to revert back to a single ad at the top.

All this is beyond me, and if necessary I'll hire someone to do it.

I saw no ad on any browser I tried. Of course, I didn't try ie7 because
that's on another computer. However, I believe you.

Anyway, is something like the following what you mean?

http://www.neredbojias.com/zyxix/zpftest.html

This works on everything. (Yeah, right.) Well, it's simple and should
work on "the big three" okay. I didn't bother with "position:fixed;"
because - why bother? If you have to kludge (for ie6), might just as
well use the kludge for everything on condition it's effective.
 
D

Don Wiss

Well bust mah britches and call me cheeky, on Sun, 30 Sep 2007 17:52:44
GMT Don Wiss scribed:

However, in Firefox the ad does not

I saw no ad on any browser I tried. Of course, I didn't try ie7 because
that's on another computer. However, I believe you.

Anyway, is something like the following what you mean?

http://www.neredbojias.com/zyxix/zpftest.html

This works on everything. (Yeah, right.) Well, it's simple and should
work on "the big three" okay. I didn't bother with "position:fixed;"
because - why bother? If you have to kludge (for ie6), might just as
well use the kludge for everything on condition it's effective.

Hi,

It isn't exactly like the demonoid one (I see the site has gone down
again), but yes, it is simple. Instead of the upper right could it be in
the middle along the right? I ask as at the tops and bottom of my pages I
have material going all the way across. That is why the demonois way was so
neat, it stayed within the table column that was between the heading and
footer sections. Having it fixed in the middle would get around this. And,
of course, being greedy, it is most important that the ad appears for all
browsers.

Thanks, Don <www.donwiss.com> (e-mail link at home page bottom).
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Mon, 01 Oct 2007 01:14:59
GMT Don Wiss scribed:
Hi,

It isn't exactly like the demonoid one (I see the site has gone down
again), but yes, it is simple. Instead of the upper right could it be
in the middle along the right? I ask as at the tops and bottom of my
pages I have material going all the way across. That is why the
demonois way was so neat, it stayed within the table column that was
between the heading and footer sections. Having it fixed in the middle
would get around this. And, of course, being greedy, it is most
important that the ad appears for all browsers.

Sure. <idiv> which contains the image get it's relative height from <body>
so just change the idiv css "top:??px;" value to "top:50%;". That'll put
the _top_ of the image in the middle. If you want exact middle-to-middle,
you'll have to try negative top margin or something on the idiv or image
itself.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top