Results 1 to 3 of 3

Thread: Image Crawler with Background Image

  1. #1
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Image Crawler with Background Image

    1) Script Title: Text and Image Crawler

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...wler/index.htm

    3) Describe problem: Is it possible to set a picture instaed of a color as background?

    At the moment you can only change the color in hex code. I would like to set an background image. But how?

    greets,
    krueemel

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That's not true. You can use almost any style property/value pairs you like. Where you have something like so to initialize the crawler (from Step 2 on the demo page):

    Code:
    <script type="text/javascript">
    marqueeInit({
    	uniqueid: 'mycrawler',
    	style: {
    		'padding': '5px',
    		'width': '450px',
    		'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
    });
    The highlighted is known as a style object. It will be parsed into actual style and applied dynamically to the crawler. So you can put anything (within reason) that you like there. Adding a background image is fine, example:

    Code:
    	style: {
    		'padding': '5px',
    		'width': '450px',
    		'background': 'lightyellow url(myimage.jpg)',
    		'border': '1px solid #CC3300'
    	},
    or:

    Code:
    	style: {
    		'padding': '5px',
    		'width': '450px',
    		'background-image': 'url(myimage.jpg)',
    		'border': '1px solid #CC3300'
    	},
    Just be sure to follow the quoting convention of the style object (also from the demo page):

    Style object for this marquee container (use quotes on both sides of the : as shown) (defaults to {'margin': '0 auto'}, which centers a marquee) If no width is specified it will default to 100%, if no height is specified, it will default to the offsetHeight of the marquee contents. Marquees whose specified or default width is greater than their contents will be automatically shrunk to avoid empty spots.
    - John
    ________________________

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

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    krueemel (09-18-2010)

  4. #3
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    thank you very much!
    i didn't know, thats it is so easy to set an image as background.

    It is a very nice and good script.

    greetz,
    krueemel

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
  •