1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

News Widget - How to Stop Script from Scrolling through News?

Discussion in 'jQuery' started by kutu62, Apr 15, 2014.

  1. #1
    The below script rotates thru <li> in a widget.
    http://code.google.com/p/professionalit/source/browse/trunk/customers/luisfelipe/src/luisfelipeimoveis/static/javascript/jquery.newsScroll.js?r=811

    I want to modify the code (or the below config) to have the widget stop rotating through the <li> after X number of <li> - the reason is I have an AD as the bottom <li> and want it to stay on top after all the news is done rotating through the widget.. if you can think of some other option that results in the Ad remaining on top Im all ears.

    Here's the config script (what Im calling a config) - placed in footer

    <script type="text/javascript">
            $('#widget').newsScroll({
                    speed: 1500,
                    delay: 5000
            });
            // or just call it like:
            // $('#widget').newsScroll();
    </script>
    Code (JavaScript):
    Thank you for your help!
     
    Solved! View solution.
    Last edited: Apr 15, 2014
    kutu62, Apr 15, 2014 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Took a look at the code, and you can have the ad there _all_ the time, if you want, and scroll the rest beneath it - would that be a solution? It involves a slight modification of the <ul><li>-code, and some mods to the newsscroll.js-file.
    It can be set to scroll through all the <li> items and stop scrolling when the container for the ad reaches the top, also, of course.
     
    PoPSiCLe, Apr 15, 2014 IP
  3. kutu62

    kutu62 Greenhorn

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #3
    That would be ideal however the widget is locked down by height 450px - and I don't want a 300px ad unit eating up all the space for the entire duration of the page-view.

    How can I make it "stop scrolling when the container for the ad reaches the top" -

    Here's the html that goes into the widget, via iframes - http://fantasyknuckleheads.com/mashed/ff-widget-make-ads.php

    Thx
     
    kutu62, Apr 16, 2014 IP
  4. #4
    Actually, if your ad is in the bottom of the list, and you're able to add a class to it (or some other selector), you can do this very simply.
    Comment out this line in the js-file:
    
     .fadeIn(300); // Fade in back in.
    
    Code (markup):
    and add the following to the first line in the callback function:
    This:
    
      $this.children('li:first')
    
    Code (markup):
    should be like this:
    
      $this.children('li:first').not('.ad')
    
    Code (markup):
    This assumes you're adding class="ad" to the <li>'s with ads in them
     
    PoPSiCLe, Apr 16, 2014 IP
  5. kutu62

    kutu62 Greenhorn

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #5
    thanks bro!
     
    kutu62, Apr 17, 2014 IP