Go Back   Dynamic Drive Forums > DD Scripts > Dynamic Drive scripts help
Search Dynamic Drive Forums:

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-25-2005, 07:59 PM
Armafair Armafair is offline
New Comer (less than 5 posts)
 
Join Date: Jun 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default CMotion and FiF issue

CMotion Image Gallery
http://www.dynamicdrive.com/dynamici...iongallery.htm

I have put the script into my page to display ten images. When viewed through IE, the script works fine, but FireFox only wants to show seven and a bit of the images before declaring End Of Gallery.

I have looked through the code but can't find any limiter of the 'length' of the slideshow (presumably IF there were one it would be in pixels, as the 'last' image diplayed in FF is only partly visible).

Any idea what the issue might be in FireFox? I haven't checked the page on other browsers yet...

Many Thanks.

A.
Reply With Quote
  #2  
Old 06-25-2005, 11:08 PM
jscheuer1's Avatar
jscheuer1 jscheuer1 is offline
No Kidding?
 
Join Date: Mar 2005
Location: SE PA USA
Posts: 18,999
Thanks: 19
Thanked 1,135 Times in 1,121 Posts
Blog Entries: 3
Default

I've run across this a few times before and was searching the archives to see if I could find the solution. I only found one relevant thread but, there, no solution was found. I distinctly remember finding one though, for another fellow. It was a tough case, one where we found a few partial solutions that had drawbacks and I needed to go over the source numerous times. Finally we came up with a workable solution. If you could supply a link to the page in question, I'll give it a crack.
__________________
WWWWWWWWWWWW
- John
________________________

Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Reply With Quote
  #3  
Old 06-26-2005, 12:11 AM
jscheuer1's Avatar
jscheuer1 jscheuer1 is offline
No Kidding?
 
Join Date: Mar 2005
Location: SE PA USA
Posts: 18,999
Thanks: 19
Thanked 1,135 Times in 1,121 Posts
Blog Entries: 3
Default

Turn's out the old adage - you learn more from your failures than you do from your successes - is true in this case. I decided to go after this problem using the case I found in the archives that I hadn't been able to solve, as it turns out, a much simpler example. By simply removing the doctype declaration, I was able to fix it. The trouble is that with a doctype of:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
and I am sure, many others, the width calculated by the script for Mozilla based browsers is wrong. So, you can either remove your doctype from the page or, find this line in the script:
Code:
actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("temp").offsetWidth
and change it to:
Code:
actualwidth=document.all? cross_scroll.offsetWidth : number
substitute for number the actual width of the gallery's train of images, use the number only - no px after it, no quotes around it. Ex:
Code:
actualwidth=document.all? cross_scroll.offsetWidth : 1850
You can find this number by adding together the display width of all the images plus the width of any padding and/or spacing. OR, just temporarily, insert this line just below that line in the unaltered script:
Code:
alert(actualwidth)
view the page in IE and use the value shown in the alert box.
__________________
WWWWWWWWWWWW
- John
________________________

Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Last edited by jscheuer1; 06-26-2005 at 04:05 AM. Reason: spelling
Reply With Quote
  #4  
Old 06-26-2005, 08:51 AM
jscheuer1's Avatar
jscheuer1 jscheuer1 is offline
No Kidding?
 
Join Date: Mar 2005
Location: SE PA USA
Posts: 18,999
Thanks: 19
Thanked 1,135 Times in 1,121 Posts
Blog Entries: 3
Default

I looked into this further and the real fix is to give the <nobr> tag on the display page an id like so:
HTML Code:
<div id="motioncontainer" style="position:relative;width:400px;height:150px;overflow:hidden;">
<div id="motiongallery" style="position:absolute;left:0;top:0;white-space: nowrap;">

<nobr id="trueContainer"><a href . . . snip!
Then in the original motiongallery.js script, change this line:
Code:
actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("temp").offsetWidth
to this:
Code:
actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("trueContainer").offsetWidth
There now, that's alot easier, huh?
__________________
WWWWWWWWWWWW
- John
________________________

Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Reply With Quote
  #5  
Old 06-27-2005, 03:06 PM
Armafair Armafair is offline
New Comer (less than 5 posts)
 
Join Date: Jun 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

A simple and elegant solution.

Many thanks for the time you invested in the problem, John. It's much appreciated.

*runs off to download some more browsers

A.
Reply With Quote
  #6  
Old 09-01-2005, 01:06 PM
Soldierflup Soldierflup is offline
New Comer (less than 5 posts)
 
Join Date: Sep 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem in Firefox

I downloaded this fantastic script and implemented it on a testpage.
In IE there are no problems, in Firefox (1.0.5) and Netscape (7.2) i'm receiving the following error :

Quote:
on line 112 : b has no properties.
The used code has been checked with the solutions given on this forumtopic.
Allthough most of the users are using IE, I would like it to work in all browsers.

I must admit i'm not an expert in javascript, so if anyone can help ???
Reply With Quote
  #7  
Old 09-01-2005, 05:02 PM
jscheuer1's Avatar
jscheuer1 jscheuer1 is offline
No Kidding?
 
Join Date: Mar 2005
Location: SE PA USA
Posts: 18,999
Thanks: 19
Thanked 1,135 Times in 1,121 Posts
Blog Entries: 3
Default

Two things at work here and I have some suggestions for refinement. First of all, you broke the 'fix' for this script when you introduced another 'containing element', a table, into the html markup. If you remove id="trueContainer" from the <nobr> tag and apply it to the <table> tag, this will correct that:
HTML Code:
    <nobr>

		<table id="trueContainer">
Second, the error you got is just an artifact caused by having another window (perhaps the javascript console itself) over the page. This is not a script breaking error and resolves itself once focus is fully returned to the window this script is in. As for suggestions, in Mozilla and with such a long image train, 7 is too low for maxspeed, so I would suggest using a test at the assignment of that variable like, where it says:
Code:
var maxspeed=7 //2) top scroll speed in pixels. Script auto creates a range from 0 to top speed.
Change it to:
Code:
var maxspeed=(document.all&&!window.opera)? 7 : 27 //2) top scroll speed in pixels. Script auto creates a range from 0 to top speed.
NOTE: This is only needed for a gallery containing so many images and the exact values (7 and 27) can be adjusted as you see fit. The 7 in this case is for IE and the 27 is for Mozilla and Opera (opera untested, may need to be removed from the conditional, take out '&&!window.opera' or change to '||window.opera' if it causes problems in opera.)

The other suggestion that I have is that if you want the galley centered, enclose the entire html part in a centered element.
__________________
WWWWWWWWWWWW
- John
________________________

Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Reply With Quote
  #8  
Old 09-02-2005, 10:58 AM
Soldierflup Soldierflup is offline
New Comer (less than 5 posts)
 
Join Date: Sep 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thx

Thank you very much. It's working now in the other browsers too.
Reply With Quote
  #9  
Old 09-11-2005, 12:10 PM
TheRec TheRec is offline
New Comer (less than 5 posts)
 
Join Date: Sep 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

I use the CMotion Gallery and I also came accross the "b has no properties" Javascript error, but I don't get this error in the same situation than "Soldierflup". It happens on FireFox (1.0.6), Netscape (7.2 & 8.0), when I use the mouse scroll button (to scroll up or down the page), while being over the gallery with the mouse cursor.

That a really particular case I admit, but maybe someone will be more successful to debug this, I tired but I couldn't find any solution to this :S My guess is that Firefox/Netscape (well Gecko) considers that the mouse moves out of the gallery (although it doesn't in my case, the scrollbar is very small) ... which call the "stopmotion" function. This error doesn't happen in Opera...

Thanks a lot for your script, and thanks in advance for your answers.
Reply With Quote
  #10  
Old 09-11-2005, 12:34 PM
TheRec TheRec is offline
New Comer (less than 5 posts)
 
Join Date: Sep 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I guess I'll answer my stupid question myself... mabye I'll help other people like me

Replace :
Code:
function contains_ns6(a, b) {
	if(b) {
		while (b.parentNode)
			if ((b = b.parentNode) == a)
				return true;
	}
	return false;
}
by :
Code:
function contains_ns6(a, b) {
  while (b.parentNode)
    if ((b = b.parentNode) == a)
      return true;
  return false;
}
It solves the problem and the script still works in MSIE5.5/MSIE6, FireFox 1.0.6, Netscape 7.2/Netscape 8.0, Opera 7.5 / Opera 8.0 , Safari 1.2.2 and MSIE 5.2 Mac.

Hope it will help, sorry again
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:06 PM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.