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

  • Home
  • SEARCH
  • 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 8965463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:48:31+00:00 2026-06-15T16:48:31+00:00

This is tricky and tough to explain, that’s why I created a jsfiddle to

  • 0

This is tricky and tough to explain, that’s why I created a jsfiddle to visualize my problem.

I have a grid of elements where every fourth element is cleared left clear:left.

I have a toggle (in my real case a filter) that is hiding some of those floated elements and I want to move the rest up and still maintain the 4by4 grid.

<div class="item"> 1 </div>
<div class="item"> 2 </div>
…

.item:nth-of-type(4n+1) { clear: left; }

See this examample: http://jsfiddle.net/K4rXM/

When clicking the “Do It!” link the nth-of-typerule is kind of neglected. Suddenly all elements float to the left and there is no clear after the 4th element.

This is actually just slightly describing my problem. Actually it is a bit more complicated with a responsive layout like i have it.

Any ideas and tipps for me? Thank you in advance,
Matt

  • 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-06-15T16:48:32+00:00Added an answer on June 15, 2026 at 4:48 pm
    $('#test').click(function(e) {
    e.preventDefault();
    $('.item').hide();
    $('.call').show();
    $('.item:visible').each(function (i) {
    if (i % 4 == 0) $(this).addClass('clearLeft');
    });
    });
    
    
    .clearLeft{clear:left;}
    

    As in my comment it’s still counting the hidden divs, you have to check which are visible, then apply a class. http://jsfiddle.net/calder12/K4rXM/4/

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

Sidebar

Related Questions

You can see the example here: http://jsfiddle.net/8EHED/8/ This is a tricky problem because I
This one is a little tricky. Say I have this XmlDocument <Object> <Property1>1</Property1> <Property2>2</Property2>
This is a little tricky so bear with me: I have a PHP script
This is a deceptively tricky little bit of HTML/JS that has either me or
I have a tricky Django problem which didn't occur to me when I was
I have an arbitrary number of polygons (hexes in this case) that are arranged
So this might be a bit tricky to demonstrate, since the problem only appears
That's tricky. I have a small button over a very big one. When the
Maybe this is a little tricky .... Someone said that: The count (of an
This is a really tricky question to ask as its very hard to explain

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.