#44024 - 28/10/2001 14:42
Javascript image popups?
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
I'm trying to compose a "What do the remote buttons do" page for the FAQ at riocar.org.
Ideally, I'd like to have GIF pictures of the Rio and Kenwood remotes up on the screen, then when the mouse moves over a button, have a small window pop up describing the function of that button. This window could be either over the button, or it could be text below the image.
I would want the text to be easily modifiable. In other words, putting up a GIF of the text is not desired.
I assume Javascript would be the easiest way to do this. does anyone have any example code for this?
Note: Things I'd like to avoid: Slicing up the image (I'd rather enter X/Y numbers into code than slice the image), using the browser's status bar text (I know how to do that, it's cheesy), and putting up message boxes that require an OK confirmation (I could do that too, but it would be irritating to use).
|
Top
|
|
|
|
#44025 - 28/10/2001 14:45
Re: Javascript image popups?
[Re: tfabris]
|
new poster
Registered: 24/10/2000
Posts: 21
Loc: South Wales, UK
|
Try to look at teh source of DVD World as they to a similar type of thing to display info about DVDs when you move your mouse over the thumbnail. I have briefly glanced at the code and it looks pretty hefty...
Edited by ChrisTall (28/10/2001 14:46)
_________________________
ChrisTall
That really is my name!
|
Top
|
|
|
|
#44026 - 28/10/2001 14:54
Re: Javascript image popups?
[Re: ChrisTall]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
That is precisely the sort of thing I'm looking for. Now, to figure out how to implement it!
If anyone has anything more easily pre-packaged, let me know.
|
Top
|
|
|
|
#44027 - 28/10/2001 15:14
Re: Javascript image popups?
[Re: tfabris]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
Hmm. Got bits of it working in my own code already. Kinda spiffy. Working on boiling it down to its simplest components and figuring out how to make it mine.
|
Top
|
|
|
|
#44028 - 28/10/2001 15:46
Re: Javascript image popups?
[Re: tfabris]
|
member
Registered: 18/11/2000
Posts: 126
Loc: Amersfoort, The Netherlands
|
You could use the ALT attribute of the IMG tag. Originally it was supposed to contain a textual description of the image, to be shown by browsers that can't display images. These days it's (ab)used by Internet Explorer and Netscape to display a tooltip when the mouse hovers over the image.
/Pepijn
|
Top
|
|
|
|
#44029 - 28/10/2001 15:48
Re: Javascript image popups?
[Re: Captain_Chaos]
|
member
Registered: 18/11/2000
Posts: 126
Loc: Amersfoort, The Netherlands
|
Aha, but you don't want to slice up the image. Never mind...
/Pepijn
|
Top
|
|
|
|
#44030 - 28/10/2001 15:49
Re: Javascript image popups?
[Re: Captain_Chaos]
|
member
Registered: 18/11/2000
Posts: 126
Loc: Amersfoort, The Netherlands
|
I have got to start reading more than one sentence of each post...
/Pepijn
|
Top
|
|
|
|
#44031 - 28/10/2001 15:53
Re: Javascript image popups?
[Re: Captain_Chaos]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
No, that's a valid comment. I actually thought about using the Alt text, but I had some other stuff I wanted to do with it. Main problem is that the Alt text isn't implemented as a tooltip for every browser.
I might end up slicing up the images anyway. The stuff I'm stealing from dvdworld wants it as separate images. I could hack the code to allow a single image, but I think I can get the job done more quickly if I just bite the bullet and slice the image.
|
Top
|
|
|
|
#44032 - 28/10/2001 16:37
Re: Javascript image popups?
[Re: tfabris]
|
addict
Registered: 19/08/2000
Posts: 588
Loc: England
|
Tony, take a look here. Is this what you're after?
_________________________
Marcus
32 gig MKII (various colours) & 30gig MKIIa
|
Top
|
|
|
|
#44033 - 28/10/2001 17:01
Re: Javascript image popups?
[Re: beaker]
|
carpal tunnel
Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
|
Doesn't work well with Netscape 6 I'm afraid, replaces the whole page with the text instead of just showing the text on the side.
Oh the joys of cross-browser compatibilty! Thank goodness I now work in exclusively on Intranet apps where I can not only specifiy the "flavour" of browser but also the version and service pack number...
_________________________
Remind me to change my signature to something more interesting someday
|
Top
|
|
|
|
#44034 - 28/10/2001 17:04
Re: Javascript image popups?
[Re: andy]
|
addict
Registered: 19/08/2000
Posts: 588
Loc: England
|
hmmm... yeah cross-browser (in)compatibility is a real PITA. It was just something I knocked up quickly. Maybe if I used a different type of tag for defining the layer that would work better.
_________________________
Marcus
32 gig MKII (various colours) & 30gig MKIIa
|
Top
|
|
|
|
#44035 - 28/10/2001 17:12
Re: Javascript image popups?
[Re: beaker]
|
carpal tunnel
Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
|
Yes, I am afraid even for all my personal stuff I tend to assume that people have access to IE5+ nowadays. I really don't have the time or energy to make it work 100% with Netscape or earlier versions of IE. I get such a small percentage of non-IE5 users visiting anyway...
_________________________
Remind me to change my signature to something more interesting someday
|
Top
|
|
|
|
#44036 - 28/10/2001 21:21
Re: Javascript image popups?
[Re: beaker]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
Yes, that is what I was after, thanks!. Of course, now it's too late, I've already implemented something based on ripping off the DVDWorld code.
Hang on to that, though, if there ends up being a problem with the DVDWorld version, I will need to fall back on it.
I don't have NS6 to test against, we'll see how it does with the DVDWorld code once I've put it up.
|
Top
|
|
|
|
#44037 - 28/10/2001 22:50
Re: Javascript image popups?
[Re: tfabris]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
Okay, I'm working on the implementation of the page and I'm filling out the data. I have some questions. Can anyone help me out?
What does the button 9 do on the Kenwood/Rio. It is labeled as "title" on the Rio. What does "title" mean in relation to what the button does?
I'm testing this out at my desk and I don't have the tuner hooked up here. Also, my Mk1 sled is no longer in a car so I can't check the Mk1 tuner functions at this time:
How do you switch AM/FM on the Mk2 tuner with the Rio remote? Is it just a hit of the Tuner button? And with the Kenwood remote, is it the same thing (hit tuner), or do the AM/FM buttons on the Kenwood remote actually do that? If not, what do the FF/REW buttons on the Kenwood do in tuner mode?
I'm sure I'll come up with some more as I work on this... And anything I don't get answered here I'm sure I can figure out for myself if I play with it...
|
Top
|
|
|
|
#44038 - 29/10/2001 05:22
Re: Javascript image popups?
[Re: tfabris]
|
old hand
Registered: 30/07/2001
Posts: 1115
Loc: Lochcarron and Edinburgh
|
One suggestion: make the image an image-map, with links to the descriptions of each button. Have the button name be the ALT of the AREA (may be useful for graphical as well as non-graphical browsers), and the full labelling as TITLE.
No Javascript anywhere (even on the one browser I use that supports it, I generally never enable it) and makes sense on text and graphical browsers.
_________________________
Toby Speight 030103016 (80GB Mk2a, blue) 030102806 (0GB Mk2a, blue)
|
Top
|
|
|
|
#44039 - 29/10/2001 05:25
Re: Javascript image popups?
[Re: tfabris]
|
old hand
Registered: 30/07/2001
Posts: 1115
Loc: Lochcarron and Edinburgh
|
In reply to:
What does the button 9 do on the Kenwood/Rio. It is labeled as "title" on the Rio. What does "title" mean in relation to what the button does?
Isn't it just another tweak-order function? Find another song with the same title (or if held, "Hate title")?
_________________________
Toby Speight 030103016 (80GB Mk2a, blue) 030102806 (0GB Mk2a, blue)
|
Top
|
|
|
|
#44040 - 29/10/2001 07:04
Re: Javascript image popups?
[Re: tms13]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
One suggestion: make the image an image-map, with links to the descriptions of each button. Have the button name be the ALT of the AREA (may be useful for graphical as well as non-graphical browsers), and the full labelling as TITLE.
I had thought about doing an image-map, but I didn't have any good tools for creating the map and defining the regions. Also, I didn't know what to do with the links other than do message-boxes with OK buttons (yuck).
It wasn't until just now that I realized I could have created a separate frame and made the TARGET of the HREFs be the frame. That would have been dead simple. Now it's too late and I've got a much more snazzy implementation based on the DVDWorld code.
|
Top
|
|
|
|
#44041 - 29/10/2001 07:04
Re: Javascript image popups?
[Re: tms13]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
Isn't it just another tweak-order function? Find another song with the same title (or if held, "Hate title")?
Didn't do anything when I tried. Anyone else?
|
Top
|
|
|
|
#44042 - 29/10/2001 07:11
Re: Javascript image popups?
[Re: tfabris]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
I'm still working on it, but if you want to look at the page in progress, you should be able to see it here.
I did end up slicing the images, once I found a free downloadable image slicer that worked well.
I'd be very interested in knowing how it performs on other browsers. I have only tested it on IE5.5 and Netscape 4.7 at this time. What about Netscape 6 and IE 4? Anyone?
|
Top
|
|
|
|
#44043 - 29/10/2001 07:12
Re: Javascript image popups?
[Re: tfabris]
|
old hand
Registered: 30/07/2001
Posts: 1115
Loc: Lochcarron and Edinburgh
|
In reply to:
Isn't it just another tweak-order function? Find another song with the same title (or if held, "Hate title")?
Didn't do anything when I tried. Anyone else?
You're right
And yes, I tried it with a song called Money (4 different, by Pink Floyd, Space, and the Flying Lizards), so it should have found another match later in the playlist.
_________________________
Toby Speight 030103016 (80GB Mk2a, blue) 030102806 (0GB Mk2a, blue)
|
Top
|
|
|
|
#44044 - 29/10/2001 08:02
Re: Javascript image popups?
[Re: tms13]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
Ah, just chatted with Roger. This button actually doesn't do anything yet. It might in a future release.
|
Top
|
|
|
|
#44045 - 29/10/2001 11:09
Re: Javascript image popups?
[Re: tfabris]
|
old hand
Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
|
Doesn't seem to work in Opera 5 and not in Netscape 6.1 either. Opera 5 reports parsing errors in script (no details though), Netscape 6.1 doesn't seem to do anything at all.
I double checked that I have javascript enabled in both browsers.
As you already ended up slicing the images, please set the ALT- and TITLE-texts as proposed in this thread. You could still use the javascript approach for the IE5 users (though I donīt like the fact that the info immediately pops up).
Also, I generally disable JScript (which includes JavaScript or vice versa) in IE.
cu,
sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord
|
Top
|
|
|
|
#44046 - 29/10/2001 11:20
Re: Javascript image popups?
[Re: smu]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
The problem with setting the ALT tag is that it gets in the way of the cool Javascript window.
I wonder how to make it work in Opera and Netscape 6. If anyone knows anything about Javascript, take a look at the stolen code (contained in http://www.riocar.org/upload/faqpics/remote_mouseover_library.htm ) and see if it can be fixed? Maybe it's something simple.
|
Top
|
|
|
|
#44047 - 29/10/2001 12:15
Re: Javascript image popups?
[Re: tfabris]
|
carpal tunnel
Registered: 23/08/2000
Posts: 3826
Loc: SLC, UT, USA
|
One request... it's looking great so far... but could you scan them at a higher res? It'd be nice to be able to actually read what's on the remotes. As it stands it's very difficult/impossible to make out some of the text on the graphics. =]
|
Top
|
|
|
|
#44048 - 29/10/2001 12:24
Re: Javascript image popups?
[Re: loren]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
Not going to happen.
My goal was to make the images take up very little screen-real-estate, not to make the buttons readable. People with small screens or who run their browsers in a small window might want to look at it.
Besides, now that I've created the tables and sliced the graphics, it would be a royal pain in the arse to do it over again. You can still see the button names when you hover over them.
If I ever change the layout of the page, it's going to be to add front-panel pictures.
|
Top
|
|
|
|
#44049 - 29/10/2001 15:13
Re: Javascript image popups?
[Re: tfabris]
|
pooh-bah
Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
|
I know you already have something working, but you may also want to look at overlib which does basically the same thing and appears to be a little more tolerant of non-mainstream browsers.
-Mike
|
Top
|
|
|
|
#44050 - 29/10/2001 15:20
Re: Javascript image popups?
[Re: mcomb]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
Holy crap. That's the exact library that DVDWorld is using. That's the library I just stole.
I didn't realize it was a licensed piece of software. I'm going to have to look at their licensing agreement and see what it involves. I might have to take it down.
Thanks for bringing it to my attention.
|
Top
|
|
|
|
#44051 - 29/10/2001 15:25
Re: Javascript image popups?
[Re: tfabris]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
Ah, OK, looks like it's freely available from the license agreement. I should just fix up some comments in the code and see if his latest version is any more browser-tolerant. Cool!
|
Top
|
|
|
|
#44052 - 29/10/2001 15:27
Re: Javascript image popups?
[Re: tfabris]
|
enthusiast
Registered: 20/02/2001
Posts: 345
|
Holy crap. That's the exact library that DVDWorld is using. That's the library I just stole.
Looking at the licence, it's the artistic, so you should be ok... I'd put a link just to be nice, but you shouldn't have to worry about taking it down...
_________________________
Synergy
[orange]mk2, 42G: [blue] mk2a, 10G[/blue][/green]
I tried Patience, but it took too long.
|
Top
|
|
|
|
#44053 - 29/10/2001 15:59
Re: Javascript image popups?
[Re: synergy]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
Yeah, it looks like he's got better support in the newer version. He still doesn't support Opera, but he's supposedly fixed the Netscape support, so we can try that out. I'll be uploading the fixed version shortly, complete with an ad-link back to his site. Good stuff.
THANK YOU for pointing that out to me, I'm glad I can link the original author.
|
Top
|
|
|
|
#44054 - 29/10/2001 17:24
Re: Javascript image popups?
[Re: tfabris]
|
old hand
Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
|
Hi.
I checked the overlib website using Netscape 6.1 and Opera 5. While Netscape looks good now, the side is completely unusable with Opera 5, it only displays some random characters (many question marks, some >128 ASCII characters,...).
Not the kind of improvement I would expect.
cu,
sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord
|
Top
|
|
|
|
#44055 - 29/10/2001 17:34
Re: Javascript image popups?
[Re: smu]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
That's to be expected, the author of overlib says he knows it doesn't support Opera.
Thanks for checking for me.
|
Top
|
|
|
|
#44056 - 29/10/2001 20:42
Re: Javascript image popups?
[Re: smu]
|
pooh-bah
Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
|
the side is completely unusable with Opera 5, it only displays some random characters (many question marks, some >128 ASCII characters,...).
I think that may be a different issue entirely. It does the same thing to me with omniweb. It looks like they have screwed up the content encoding or charset. Anyway, I am guessing that is a problem with the site's webserver setup and not overlib itself.
-Mike
|
Top
|
|
|
|
#44057 - 30/10/2001 04:49
Re: Javascript image popups?
[Re: smu]
|
new poster
Registered: 18/07/2001
Posts: 41
Loc: Koblenz, Germany
|
Hi,
i've updated a version ov overLIB some time ago to support Opera and Netscape 6. You can see it in action here: http://epaper.rhein-zeitung.de/01/10/20/
(so you can test if it really works in opera - i think it should but i've got no time to test right now)
the source is located here: http://epaper.rhein-zeitung.de/common/rzlib.js
i could extract the relevant parts of rzlib.js for riocar.org...
alex
|
Top
|
|
|
|
#44058 - 30/10/2001 05:10
Re: Javascript image popups?
[Re: ghostwheel]
|
old hand
Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
|
Hi.
It only partly works in Opera 5:
It does update the title that is displayed in the upper left corner (the name of the local newspaper), but it does not show the info box. It works in Netscape 6.1 as expected (as in IE with JScript enabled).
I still dislike this approach: It is totally dependent on JavaScript, which anyone with a decent security has disabled in IE (as IEs JavaScript is only enabled when JScript is enabled, which in turn has a lot of security problems JavaScript in its own doesn't have). And I really don't see any real advantage over the ALT- and TITLE approach.
cu,
sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord
|
Top
|
|
|
|
#44059 - 30/10/2001 05:18
Re: Javascript image popups?
[Re: smu]
|
new poster
Registered: 18/07/2001
Posts: 41
Loc: Koblenz, Germany
|
Hi,
I think the JavaScript popups just look cooler .
Perhaps we could do both - ALT/TITLE _and_ POPUPS.
If JS is enabled it clears the ALT/TITLE on load so they wont show up.
If JS is disabled you can see the ALT/TITLE and no popup.
I don't know if this will work in older browsers (NS4.x) - DOM browsers should be fine.
Alex
|
Top
|
|
|
|
#44060 - 30/10/2001 05:35
Re: Javascript image popups?
[Re: ghostwheel]
|
old hand
Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
|
I think the JavaScript popups just look cooler .
You are right, they look way cooler. However, I have a few propositions:
1. The <a href> tags should point to a meaningful target, not just to the
document itself. If they are intended to point back to the document itself
(to the start of it), add an "on click" JavaScript function that returns "False",
so that they are disabled when javascript is working.
2. Add a page that works with Javascript being completely disabled. If needed,
simply show the remotes, and list a description of the button functions below.
I just enabled Jscript in IE for the tests on this page only, I usually have it disabled. And I strongly recommend that everybody else does so, too, or at least have it set to ask for permission before executing the scripts.
JScript (not Javascript) is way too easily hackable.
cu,
sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord
|
Top
|
|
|
|
#44061 - 30/10/2001 11:23
Re: Javascript image popups?
[Re: ghostwheel]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
Nice page. I'm not going to implement that library, though, as I'm interested in using the latest version of the author's original code. It's got some recent bug fixes that I think are important.
Did you send the author your Opera fixes for him to integrate?
|
Top
|
|
|
|
#44062 - 30/10/2001 11:25
Re: Javascript image popups?
[Re: ghostwheel]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
If JS is enabled it clears the ALT/TITLE on load so they wont show up.
Can you give me more pointers as to how to set this up?
|
Top
|
|
|
|
#44063 - 30/10/2001 11:31
Re: Javascript image popups?
[Re: smu]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
The a href tags should point to a meaningful target, not just to the document itself. If they are intended to point back to the document itself (to the start of it), add an "on click" JavaScript function that returns "False", so that they are disabled when javascript is working.
I deliberately did it the current way on purpose because Netscape 4x has some bugs for which that is the work around:
1) The popups don't work unless it's a link. They don't work for just images.
2) If you click on something or resize while netscape is loading the page, the javascript fails, and then the page will not show popups. If you click on the image and have it redirect to itself, that forces a page reload which re-loads the javascript and makes it work again.
Add a page that works with Javascript being completely disabled. If needed,
simply show the remotes, and list a description of the button functions below.
I would like to avoid maintaining two pages. If I can get the Alt text working with that single htm file, I'll implement that.
|
Top
|
|
|
|
#44064 - 30/10/2001 12:38
Re: Javascript image popups?
[Re: tfabris]
|
member
Registered: 19/12/1999
Posts: 117
|
what about doing something like:
A HREF="javascript:;" .....
Since it looks like you are going after a JavaScript 'do nothing'.
|
Top
|
|
|
|
#44065 - 31/10/2001 10:01
Re: Javascript image popups?
[Re: tfabris]
|
new poster
Registered: 18/07/2001
Posts: 41
Loc: Koblenz, Germany
|
Hi,
> Did you send the author your Opera fixes for him to integrate?
Nope, cause it doesn't really work (anymore) :-(
Alex
|
Top
|
|
|
|
#44066 - 31/10/2001 10:20
Re: Javascript image popups?
[Re: tfabris]
|
new poster
Registered: 18/07/2001
Posts: 41
Loc: Koblenz, Germany
|
Hi,
i've "hacked" a quick demo for you here http://ghostwheel.de/demo.html.
i'm think it currently only works in Mozilla and IE>6 ... but i've not tested it.
If Javascript is enabled you can clear the alt/title tags by pressing "clear tags" - this should be done onLoad - but it's only a demo ;-)
"show alt tag" and "show title tag" display the image's alt/title
the "NOSCRIPT" is for browsers without javascript.
Alex
|
Top
|
|
|
|
#44067 - 31/10/2001 15:50
Re: Javascript image popups?
[Re: ghostwheel]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
I'll have to look at this more closely later. On my current system, it produces strange results. It still has the alt text come up over the overLIB window (the reason I didn't use alt text to begin with).
|
Top
|
|
|
|
#44068 - 01/11/2001 17:28
Re: Javascript image popups?
[Re: tfabris]
|
new poster
Registered: 18/07/2001
Posts: 41
Loc: Koblenz, Germany
|
> I'll have to look at this more closely later.
Jup, I'll try to make the script work in all browsers (Opera, Netscape > 4, IE > 4 and Mozilla) - Currently it only works in DOM-compatible browsers.
Alex
|
Top
|
|
|
|
#44069 - 02/11/2001 06:44
Re: Javascript image popups?
[Re: ghostwheel]
|
pooh-bah
Registered: 13/09/1999
Posts: 2401
Loc: Croatia
|
BTW, is DOM part of ECMA JavaScript standard?
_________________________
Dragi "Bonzi" Raos
Q#5196
MkII #080000376, 18GB green
MkIIa #040103247, 60GB blue
|
Top
|
|
|
|
|
|