954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Image Marquee Truncates

I have built a marquee of images that scrolls inside a cell of a table. The marquee width, of course, is dictated by the width of the cell. But I don't want the number of images that actually scroll inside the marquee to cut off based on the width of the marquee. In other words, if 5 images fit across the width of the cell, then the marquee scrolls 5 images. If there are 6 or more images, those images get cut off and the marquee loops back to the beginning of the list of images.

Is there a way to prevent this? I simply want all the images to scroll until it gets to the end of the list then start over (the way it works with plain text).

I've tried playing with the behavior parameter and setting overflow to visible but so far nothing has worked.

ms_sws
Light Poster
31 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

Please provide code or a link.

fxm
Posting Pro
596 posts since Apr 2010
Reputation Points: 40
Solved Threads: 74
 

The is the same file (gallery.html) as discussed in the load files to array post. I dynamically build a marquee then document.write it:

gMarqueePics="

"; // gctr holds on to the number of files in gFiles since it is used throughout the page for (i=0; i<=gctr; i++) { gMarqueePics=gMarqueePics+""+gFiles[i]+""; } gMarqueePics=gMarqueePics+""; document.write(gMarqueePics);

I also parse the file name which contains data about the image (i.e. name, identifier, DOB, etc.) and similarly dynamically build a text marquee then document.write it. The code is the same except that I added the behavior and style parameters to the image marquee in an attempt to solve the truncation problem. The text marquee does not truncate. Both are written one after the other inside a table.

There are 6 images currently and 5 fit across the width of the table. Actually a few pixels of the 6th image also fits and you can see when the marquee scrolls, those few pixels display before the marquee starts scrolling from the first image.

There must be a way of defining the marquee to scroll all images then start over. Isn't there?

ms_sws
Light Poster
31 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

Without the table I can only guess what is happening.

fxm
Posting Pro
596 posts since Apr 2010
Reputation Points: 40
Solved Threads: 74
 

Well, the html file used a freebie template off the web so the formatting of the tags inside it was rather messy to look at. On top of this, there were tables inside tables and extraneous rows/columns. In the interest of being able to read the code with some consistent indenting and removing the tds and trs that had content between them but are not helpful relative to this problem, I've extracted the table(s) that impace the marquee in question. I left in some javascript that I deleted in the above example (just to put focus on the script in question). So the code in question is:


Gallery

Here's a sampling of the little ones we have in our care that are or will be available for adoption.

Alternate Photo Placeholder

No Featured Pet Selected This Month

FEATURED PET OF THE MONTH



ms_sws
Light Poster
31 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

When you post code, please use the [ CODE ] button.
I suspect that you are trying to run the marquee in an element that has margins.

By taking 'extraneous' stuff out of the table you may well have changed the margins or even the content around the problem area by enough that I can't see what you're seeing.

I may get a chance to look at this in the next day or two, but if the page doeasn't run when I load it I'm not going to bother trying to repair is.

fxm
Posting Pro
596 posts since Apr 2010
Reputation Points: 40
Solved Threads: 74
 

gpic is not defined
gctr is not defined
gFiles is not defined
parseFile is not defined

That's where I stopped.

fxm
Posting Pro
596 posts since Apr 2010
Reputation Points: 40
Solved Threads: 74
 

Okay. I've had my hands full with a bunch of things. What I've noticed about the marquee problem is that I get 3 different behaviors across IE, Chrome and Firefox.

As I said, the width of the table (nested inside other tables) can accommodate 5 pictures at a time. So in IE, the marquee scrolls 5 pictures (and a bit of the 6th) then starts back at the first picture). Firefox works properly and scrolls all pictures then starts at the beginning. Chrome doesn't scroll at all. I get all pictures looking like static img tags running 5 across and centered (the marquee is centered) so with 6 pictures I get one row of 5 centered then a second row with the last one centered.

ms_sws
Light Poster
31 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: