Results 1 to 7 of 7

Thread: DD Text and Image Crawler marquee style to CSS

  1. #1
    Join Date
    May 2010
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question DD Text and Image Crawler marquee style to CSS

    Hello,

    1) Script DD Text and Image Crawler:

    2) http://www.dynamicdrive.com/dynamici...wler/index.htm

    3) Describe problem:

    I am using this script with great satisfaction.

    What I would like to do is to transfer the style for the marquee to my css-file that is called in my parrent php-file. This way the styling can be done from 1 location. I have been trying for some time, but i could not get it to work.

    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
    });
    </script>
    Thanks in advance

    John7P
    Last edited by jscheuer1; 08-15-2010 at 02:33 PM. Reason: fix broken link

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,925
    Thanks
    43
    Thanked 3,187 Times in 3,151 Posts
    Blog Entries
    12

    Default

    I don't think that there is any way to do that. The script uses these values for more than simply styling the crawler, and the elements to which they are applied vary depending upon a number of considerations.

    If what you want is consistency and a central location to edit them, use an include:

    PHP Code:
    <script type="text/javascript">
    marqueeInit({
        uniqueid: 'mycrawler',
        style: {
    <?php include(mycrawlerstyles.txt); ?>
        },
        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>
    Then in mycrawlerstyles.txt you could have:

    Code:
    		'padding': '5px',
    		'width': '450px',
    		'background': 'lightyellow',
    		'border': '1px solid #CC3300'
    But, if the entire crawler is used throughout, you could do this for all of the code, even the markup. Or if only the items in the crawler vary, it could be just the script from your post, at that rate you could use an external script, rather than an include.
    - John
    ________________________

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

  3. #3
    Join Date
    May 2010
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Is this something?

    Hello John,

    I have found this piece of script on the net, is there a way to use this?
    I tried it myself, but I am not much of a js-user.

    Code:
    <script type="text/javascript">
    
    function getStyle(el, cssprop){
     if (el.currentStyle) //IE
      return el.currentStyle[cssprop]
     else if (document.defaultView && document.defaultView.getComputedStyle) //Firefox
      return document.defaultView.getComputedStyle(el, "")[cssprop]
     else //try and get inline style
      return el.style[cssprop]
    }
    
    var mydiv=document.getElementById("test")
    
    alert(getStyle(mydiv, 'width')) //alerts 100px
    alert(getStyle(mydiv, 'backgroundColor')) //alerts yellow
    
    </script>
    Something that did work was to :
    Code:
    <script type="text/javascript">
    var m_width = '300px'
    marqueeInit({
    	uniqueid: 'mycrawler2',
    	style:{
     		'padding': '2px',
    		'width': m_width,
    Now how do I fill m_width using getstyle()?
    And is the stylesheet linked to in the parrent php file available for use here?

    John..

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,925
    Thanks
    43
    Thanked 3,187 Times in 3,151 Posts
    Blog Entries
    12

    Default

    I wouldn't. Getting style requires that the element exists and even if it does, often it must be fully rendered for the gotten style to be accurate. The returned style is not required to be in the units specified in the stylesheet or elsewhere. Changes to the window size after page load may produce odd results. You might be able to get it to 'work' with one specific set of styles. But if you do, making changes to the stylesheet could produce unexpected results.

    Use an include or an external script. Either of these will get you consistent centralized control over this.

    How many pages use a crawler?

    Are all your crawlers identical?

    Do they all share the same init, but use different content?

    Or is the style the only shared aspect?

    Answer those questions, and I can give you one or more specific methods that will work in all cases.
    - John
    ________________________

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

  5. #5
    Join Date
    May 2010
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up

    Hello

    How to explain......

    The element exists as do the correct units, I make sure of that in the css.file.
    That css-file is appended to the main stylesheet Joomla everytime this package loads.

    If there are other crawlers active, they will be seperate from this one. Only the parrent.php is goeing to call on this script only once per page-load.

    I could set the style elements in the back-end of Joomla 1.5 CMS by variable. But then people who install this package sets some styling via a stylesheet, and others via the Joomla-backend.

    I my humble opinion, it seems more logical to set all styling in the css.

    Hope this helps

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,925
    Thanks
    43
    Thanked 3,187 Times in 3,151 Posts
    Blog Entries
    12

    Default

    You lost me with most of that. But believe me (the script's author), logical or not, it would require at least a minor, if not a major rewrite of the script to allow that.

    If you are dead set on achieving this though, fresh eyes might see a way.

    In that case, feel free to ask me to delete this thread (otherwise one of the other mods might merge or delete a new thread). Then you can then start a new one, and perhaps someone else will have a different idea.

    If on the other hand, you want to pursue the external script or include ideas, both of which I consider workable without too much trouble, let me know
    - John
    ________________________

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

  7. #7
    Join Date
    May 2010
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up

    Ok no problem,

    I may not be able to explain the question propery.
    Consider this subject closed

    I thank you for your time John.

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
  •