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 975187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:32:49+00:00 2026-05-16T03:32:49+00:00

I have a perculiar problem with the :last and .before() method not inserting the

  • 0

I have a perculiar problem with the :last and .before() method not inserting the code before the last element.


[edited]

I have come up with a new issue :/


The problem is (now that the <li>‘s are in order), that the Carousel will now scroll through 4 items but them quickly jump to the next item.

Code below.
(also, I think it is this: $('#carousel_ul').css({'left' : '0px'}); that is doing it – on lines 19 an 37.

Thanks very much.

$(document).ready(function () { 
    var numItems = $('#carousel_ul').find('li');
    var visibleItems = 4;
    var difference = visibleItems % numItems.length;

    $('#carousel_ul li').last().before($('#carousel_ul li:last')+$('#carousel_ul li:last')); 

    while (difference > 1) {
        $('#carousel_ul li:last').after('<li class="empty" style="background-color: green;"></li>');
        difference--;
    }

    $('#right_scroll a').click(function(){
        var item_width = $('#carousel_ul li').outerWidth() + 10;
        var left_indent = parseInt($('#carousel_ul').css('left')) - (item_width * 4);

        $('#carousel_ul:not(:animated)').animate({'left' : left_indent},1500,function(){    
            $('#carousel_ul li:last').after($('#carousel_ul li:first')); 
            $('#carousel_ul').css({'left' : '0px'}); //error here?
        }); 
        return false;
    });

    $('#carousel_ul li').each(function(intIndex) {
        var itemName = $(this).attr('name');
        $(this).html(itemName);
        console.log(itemName);
    });

    $('#left_scroll a').click(function(){

        var item_width = $('#carousel_ul li').outerWidth() + 10;
        var left_indent = parseInt($('#carousel_ul').css('left')) + (item_width * 4);

        $('#carousel_ul:not(:animated)').animate({'left' : left_indent},1500,function(){     
            $('#carousel_ul li:first').before($('#carousel_ul li:last')); 
            $('#carousel_ul').css({'left' : '0px'}); //error here?
        });
        return false;
    });
    $('#tabcontainer > ul').tabs();
});

And the CSS:

#carousel_inner {
float:left; /* important for inline positioning */
width:800px; /* important (this width = width of list item(including margin) * items shown */ 
height: 150px;
position: relative;
overflow: hidden;  /* important (hide the items outside the div) */
/* non-important styling bellow */
background: #F0F0F0;
z-index: 15;
}

#carousel_ul {
position:relative;
left:0px; /* important (this should be negative number of list items width(including margin) */
list-style-type: none; /* removing the default styling for unordered list items */
margin: 0px;
padding: 0px;
width:9999px; /* important */
height: 150px;
min-height: 150px;
/* non-important styling bellow */
padding-bottom:10px;
z-index: 15;
}

#carousel_ul li{
float: left; /* important for inline positioning of the list items */                                    
width:205px;  /* fixed width, important */
/* just styling bellow*/
padding:0px;
border: 1px solid black;
height:150px;
min-height: 150px;
z-index: 15;
}

#carousel_ul li img {
.margin-bottom:-4px; /* IE is making a 4px gap bellow an image inside of an anchor (<a href...>) so this is to fix that*/
/* styling */
cursor:pointer;
cursor: hand; 
border:0px; 
z-index: 15;
}
#left_scroll, #right_scroll{
float:left; 
height:130px; 
width:15px; 
background: #C0C0C0; 
z-index: 15;
}
#left_scroll img, #right_scroll img{
/*styling*/
cursor: pointer;
cursor: hand;
z-index: 15;
}
  • 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-16T03:32:50+00:00Added an answer on May 16, 2026 at 3:32 am

    I fixed this by manually setting the CSS animation -160px.

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

Sidebar

Related Questions

I have a very peculiar problem:(not using web.config) DefaultFacebookApplication dfa=new DefaultFacebookApplication(); dfa.AppId = ...;
I have a challenging problem I've been battling for some time now. The Problem:
I seem to have run into a peculiar problem. Here is the code #read
I have a peculiar problem. I was tasked with refactoring some old c code
I have a peculiar problem with Postgres and PHP . I just set-up new
I have a very peculiar problem and my last resort was asking this on
I appear to have a peculiar problem. I've got the following code snippet and
I have a peculiar problem, which I think that a lot of other people
I have a peculiar problem. I created a normal Objective C class called SampleTable.
I have a work around for this problem, but I've been noticing some peculiar

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.