Weird display layout of images on first load of my web page

Viewed 91

I'm trying to build my web portfolio through GitHub Pages, and everything works as expected when I test it locally. But, when I commit to GitHub and test it, I am getting weird behavior like this:

Weird Behavior 1

Weird Behavior 2

But, I also get the correct behavior, especially if I reload the page.

Correct Behavior

What causes this weird jumping?

.item-list {
  overflow: hidden;
  text-align: center;
  margin: 0 0 0 -24px;
}

.item-list li {
  display: inline-block;
  margin: 0 0 25px 24px;
  vertical-align: top;
  font-size: 0;
}

.item {
  text-align: center;
  width: 270px;
  margin: 0 auto;
}

.item .image {
  position: relative;
}

.item .image img {
  min-width: auto;
  max-width: 100%;
  height: auto;
  border-radius: 50%;
}

.item .hover {
  display: none;
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
  background: #6abb84;
  opacity: 0.9;
  border-radius: 50%;
  behavior: url(css/PIE.htc);
}

.item .hover.active {
  display: block;
}

.item .item-content {
  position: relative;
  display: table-cell;
  vertical-align: middle;
  height: 270px;
  z-index: 400;
  padding: 0 30px;
}

.item a {
  text-decoration: none;
}

.item .item-content h4 {
  display: block;
  background: url(../images/bg_white_border.gif) no-repeat 50% 100%;
  color: #fff;
  text-transform: uppercase;
  font-family: 'novecentosanswide';
  font-weight: bold;
  font-size: 14px;
  line-height: 16px;
  padding: 0 0 20px;
  text-align: center;
  margin: 0 0 15px;
}

.item .item-content p {
  color: #fff;
  text-align: center;
  display: block;
  font-size: 15px;
  line-height: 17px;
}


/*contact*/

.clear {
  clear: both;
}

.images_holder {
  float: left;
  margin: 5px 130px 0 0;
  width: 370px;
}

.images_holder img {
  width: 100%;
  height: auto;
  display: inline;
}
<ul id="container" class="item-list">
  <li class="item web key">
    <div class="image ">
      <img src="images/dungeon_mobile.png" alt="" />
      <div class="hover">
        <a class="fancybox" rel="gallery1" href="#portfolio_1">
          <div class="item-content">
            <h4>Dungeon Mobile</h4>
            <p>2D RPG Mobile Game Currently Under Development</p>
          </div>
        </a>
      </div>
    </div>
  </li>
</ul>

Website reference: https://panoskikas.github.io/
Repo: https://github.com/PanosKikas/PanosKikas.github.io

2 Answers

You can click the "All Works" link using Javascript:

document.querySelector('li.active').click()

I've tested this in the Chrome Developer Console, and it should work. Just put this into a script tag at the end of the body element.

<script>
  document.querySelector('li.active').click()
</script>

So, I've managed to hack my way through it by clicking the All Works button after the page has been completely loaded:

    <script>
    window.addEventListener('load', function () {
      document.querySelector('li.active').click()
    })
    </script>

I'm not fully content with this solution but it's better than before. If someone has a better solution please share it!

Related