javascript - 第一次加载我的网页时图像的奇怪显示布局

标签 javascript html jquery css

我正在尝试通过 GitHub Pages 构建我的 Web 作品集,当我在本地测试时,一切都按预期进行。但是,当我提交到 GitHub 并对其进行测试时,我遇到了这样的奇怪行为:

Weird Behavior 1

Weird Behavior 2

但是,我也得到了正确的行为,尤其是当我重新加载页面时。

Correct Behavior

是什么导致了这种奇怪的跳跃?

.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>

网站引用:https://panoskikas.github.io/
repo :https://github.com/PanosKikas/PanosKikas.github.io

最佳答案

您可以使用 Javascript 单击“所有作品”链接:

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

我已经在 Chrome 开发者控制台中对此进行了测试,它应该可以正常工作。只需将其放入 body 元素末尾的 script 标记即可。

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

关于javascript - 第一次加载我的网页时图像的奇怪显示布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64065854/

相关文章:

javascript - jquery多选下拉复选框从数据库获取数据?

html - CSS中 "color"等样式元素如何应用到img等元素上?

jquery - 仅限 OSX Firefox 中的 CSS 混合混合模式错误

jQuery 和 $.post

javascript - 适用于 iPhone 的极简主义可缓存 jQuery/javascript 库?

javascript - 如何确定我的页面是在普通浏览器还是 SAP CL_GUI_HTML_VIEWER 中呈现

javascript - 谷歌地图 API 和 Github 页面

javascript - 使函数相互依赖

javascript - 使用带有变量的 .css() 定义 css 属性值的问题

html - 在 &lt;footer&gt; 元素中使用 2 个部分的问题