Results 1 to 4 of 4

Thread: Text and Image Crawler specified width

  1. #1
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Text and Image Crawler specified width

    Is there a way that I can change the script that the width stays as it is specified in the CSS. I need the scrolling area to stay a specific width on my website even if it has a bit of an empty spot in it.
    http://www.dynamicdrive.com/dynamici...wler/index.htm

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,070
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Well it won't exactly make a gap. It will have a gap that gets filled in suddenly at one or more points is more like it.

    And this should only be an issue if you've setup the crawler with a percent width and there's nothing to limit it from becoming wider than the width of the content of its division (it's text and/or image train).

    If you have a fixed width, just add blank images,   characters, text or duplicates of what you do have to fill it out.

    If what you're going for is like a crawling banner across the page, I'd suggest simply duplicating the content like 30 times or more so that it would be very unlikely that a gap could occur.

    That all said, this version of the script removes the limitation on the width allowing the slightly erratic behavior described above if the width exceeds the content:

    Attachment 4014
    - John
    ________________________

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

  3. #3
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks John.

    My problem is that I populate the crawler with text from a database (breaking news for a newspaper website), so I don't know the length. I willl look at the link you added.

    C

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,070
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Then I don't see why you wouldn't want the crawler to shrink. If it's a layout issue, like if there's a certain amount of space that must get filled, you could center the crawler within that space, something like:

    Code:
    <div style="width: 500px;">
    <div class="marquee" id="mycrawler"><?php echo $whatever; ?></div>
    <script type="text/javascript">
    marqueeInit({
    	uniqueid: 'mycrawler',
    	style: {
    		'padding': '5px',
    		'width': '100%',
    		'margin': '0 auto', //centers crawler inside its parent element
    		'background': 'lightyellow',
    		'border': '1px solid #CC3300'
    	},
    	inc: 8, //speed - pixel increment for each iteration of this marquee's movement
    	mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
    	moveatleast: 4,
    	neutral: 150,
    	savedirection: true
    });
    </script>
    </div>
    That way it will always take up 500px or whatever you set the outer div to be, but if it doesn't have enough content to fill that out completely, it will shrink and center itself within that space.

    Note: For IE less than 9, the margin 0 auto requires that the page have a standards invoking DOCTYPE in order to work at centering the crawler.
    - John
    ________________________

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •