Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4607392
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:41:49+00:00 2026-05-22T00:41:49+00:00

I am trying to detect whether this is the last element of a list.

  • 0

I am trying to detect whether this is the last element of a list. This code did not work. What would?

if((visel).is($('#twitnews li:last'))) {
        var nextel =  $('#twitnews li').first();
    }
    else {
    var nextel = $(visel).next();
    }

HTML: (dynamically generated but here is the source from one page)

<div id="twitnews" style="padding-left:20px; line-height:20px; float:left;">

        <li>
         Rawwwwrrrr! (@ Great Life Golf & Fitness- Berkshire) http://4sq.com/kCoZKV
        </li>
        <li>
         Swinley Forest Golf Club, Coronation Road, Ascot, Berkshire - Golf Courses http://t.co/fuoN2LW via @AddThis
        </li>
        <li>
         Had to resort to biking indoors tonight. (@ Great Life Golf & Fitness- Berkshire) http://4sq.com/jhbqK2
        </li>
        <li>
         In my golf course review of The Berkshire Blue course I found this to be a great day out, the course is fantastic... http://fb.me/AYkQDseI
        </li>
        <li>
         I'm at Berkshire Hills Golf Club http://4sq.com/kUAPK2
        </li>
        <li>
         Played Berkshire Valley GC in Morris County NJ.  Course was really nice.  Pics and video review of the course.  http://bit.ly/mAjRcz
        </li>
        <li>
         Review for: The Berkshire Golf Club Blue Course. Great course http://bit.ly/hUqV8e
        </li>
        <li>
         A group of four friends from West Berkshire are getting ready to tee off for a charity golf challenge http://bit.ly/l1IWD6
        </li>
        <li>
         I'm at Great Life Golf & Fitness- Berkshire (3720 SW 45th St., at Stone Ave., Topeka) http://4sq.com/jbOX6g
        </li>
        <li>
         Berkshire golf club, hang your head in shame with the state those greens were in! Worst greens i have putted on EVER! #horrific
        </li></div>
<script type="text/javascript">
$('#twitnews li').hide();
$('#twitnews li').first().fadeIn(300, function fade(){

    var visel = $('#twitnews li:visible');

    if($(visel).is($('#twitnews li:last'))) {
        var nextel =  $('#twitnews li').first();
    }
    else {
    var nextel = $(visel).next();
    }


    $(visel).delay(3000).fadeOut(300, function(){

        $(nextel).fadeIn(300, function(){fade()});

        });

    });
        </script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:41:50+00:00Added an answer on May 22, 2026 at 12:41 am

    This works as is if you’re using jquery 1.6:

    http://jsfiddle.net/Da8ja/2/

    if you’re below 1.6 then you need to change this:

    visel.is($('#twitnews li:last'))
    

    The ability to pass a jquery object to is was added in 1.6. You would need to do something like this:

    if(visel[0]==$('#twitnews li:last')[0]) {
    

    http://jsfiddle.net/Da8ja/3/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to work out how to detect whether a user is running
I am trying to detect whether a particular pixel is filled or not in
I am trying to detect whether a block of text (from a textarea) contains
I'm trying to detect whether an image exists on a remote server. However, I've
In a BASH script, I'm trying to detect whether a file exists. The filename
I am trying to create a script to detect whether a directory exists, and
I am trying to retrieve the environment variable to detect whether the system is
I'm trying to detect whether a device has a wifi or 3g connection. If
I am trying to detect if a browser supports 3d css transform or not
I'm trying to use curl to detect whether a piece of text exists in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.