iPad/iPhone 上的 z 索引问题

发布于 2025-01-03 04:36:10 字数 521 浏览 2 评论 0原文

首先,我对 CSS/HTML 的经验很少,我不是网页设计师/编码员,基本上我不知道我在做什么。

我也差点自杀了,因为没有任何帮助。我真的很感谢所有试图帮助我的人。

当您访问 pawelpietryka.com 并将鼠标悬停在图像上时,它会通过 webkit 过渡在 div 中滑动,基本上一切正常。

我还使用了一个 webkit 嵌入阴影,它也是动画的。我对这个阴影有很大的问题,因为它总是出现在图像后面(而不是前面)...

#demo-5 img { z-index: -1; position: relative; vertical-align: top; }

一旦我输入 z-index: -1;, 我就用这些更改来破解它。因为它不再适用于 iPad/iPhone,我点击容器但没有任何反应。

(我假设它没有悬停状态,当我尝试点击它时,它在主层后面。)

我在其他页面上看到了这一点,理想的情况是:1)第一个点击框滑入 2) 第二次点击跳转到目的地。

谢谢!

first of all I have very little experience with CSS/HTML, I'm not a webdesigner/coder, basically I have no clue what I'm doing.

I'm also close to kill myself because nothing helped. I really appreciate everyone who's trying to help me.

When you go on pawelpietryka.com and hover on the image it slides in a div via webkit transition and basically everything works.

I'm also using a webkit inset shadow which is animated too. I had big issues with this shadow because it always appeared behind the image (not in front) ... I hacked it with these changes

#demo-5 img { z-index: -1; position: relative; vertical-align: top; }

As soon as I put the z-index: -1; in it doesn't work on iPad/iPhone anymore, I'm tapping on the container and nothing happens.

(I'm assuming it doesn't have a hover state and when I'm trying to tap it it's somehow BEHIND the main layer.)

I've seen this on other page and the ideal scenario would be: 1) First tap box slides in 2) Second tap jump to destination.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

樱花细雨 2025-01-10 04:36:10

如果您将 div 嵌套视为金字塔,例如...

<pyramid>
  <section level="1">
    <section level="2">
    </section>
  </section>
</pyramid>

您无法让级别 2 出现在级别 1 下,因为级别 1包含级别 2。如果您希望级别 2 出现超过 2 级,通常它们是兄弟姐妹,即

<pyramid>
  <section level="1"></section>
  <section level="2"></section>
</pyramid>

但在您的具体情况下,我建议将图像作为 div 的背景

<div id="boxes">
  <?php while ( have_posts() ) : the_post(); ?>
    <div class="box">
      <a href="<?php the_permalink(); ?>">
        <div class="rel" id="demo-5" style="background: transparent url(<?php the_post_thumbnail('homepage-thumb'); ?>) top left no-repeat">
          <div class="detailsausgeblendet">
            <h1><?php the_title(); ?></h1>
            <?php the_excerpt() ?>
          </div>
        </div>
      </a>
    </div>
  <?php endwhile; ?>
</div>

If you think of your div nesting as a pyramid such as...

<pyramid>
  <section level="1">
    <section level="2">
    </section>
  </section>
</pyramid>

You can't get level 2 to appear under level 1, because level 1 contains level 2. If you would want level 2 to appear over level 2, usually they would be siblings, i.e

<pyramid>
  <section level="1"></section>
  <section level="2"></section>
</pyramid>

But in your specific case, I would recommend putting the image as the background of the div

<div id="boxes">
  <?php while ( have_posts() ) : the_post(); ?>
    <div class="box">
      <a href="<?php the_permalink(); ?>">
        <div class="rel" id="demo-5" style="background: transparent url(<?php the_post_thumbnail('homepage-thumb'); ?>) top left no-repeat">
          <div class="detailsausgeblendet">
            <h1><?php the_title(); ?></h1>
            <?php the_excerpt() ?>
          </div>
        </div>
      </a>
    </div>
  <?php endwhile; ?>
</div>
九命猫 2025-01-10 04:36:10

试图将其发布在这里,评论的格式很奇怪

<div id="boxes">
<?php while ( have_posts() ) : the_post(); ?>

    <div class="box">
        <a href="<?php the_permalink(); ?>"><div class="rel" id="demo-5" style="background-image:<?php the_post_thumbnail('homepage-thumb'); ?>">
                    <div class="detailsausgeblendet">
<h1><?php the_title(); ?></h1>
        <?php the_excerpt() ?>
                    </div>


    <?php endif ?>

        </div></a>
    </div>

<?php endwhile; ?>
</div>

Trying to post it here, the formatting is odd on comments

<div id="boxes">
<?php while ( have_posts() ) : the_post(); ?>

    <div class="box">
        <a href="<?php the_permalink(); ?>"><div class="rel" id="demo-5" style="background-image:<?php the_post_thumbnail('homepage-thumb'); ?>">
                    <div class="detailsausgeblendet">
<h1><?php the_title(); ?></h1>
        <?php the_excerpt() ?>
                    </div>


    <?php endif ?>

        </div></a>
    </div>

<?php endwhile; ?>
</div>
优雅的叶子 2025-01-10 04:36:10

这是“未更改”的代码

<div id="boxes">
<?php while ( have_posts() ) : the_post(); ?>

    <div class="box">
        <div class="rel" id="demo-5">
            <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('homepage-thumb', array('alt' => '', 'title' => '')) ?></a>
    <?php if ($imbalance2_theme_options['images_only'] == 0): ?>

                    <a href="<?php the_permalink(); ?>"><div class="detailsausgeblendet">
<h1><?php the_title(); ?></h1>
        <?php the_excerpt() ?>
                    </div></a>


    <?php endif ?>

        </div>
    </div>

And this is the code 'unchanged'

<div id="boxes">
<?php while ( have_posts() ) : the_post(); ?>

    <div class="box">
        <div class="rel" id="demo-5">
            <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('homepage-thumb', array('alt' => '', 'title' => '')) ?></a>
    <?php if ($imbalance2_theme_options['images_only'] == 0): ?>

                    <a href="<?php the_permalink(); ?>"><div class="detailsausgeblendet">
<h1><?php the_title(); ?></h1>
        <?php the_excerpt() ?>
                    </div></a>


    <?php endif ?>

        </div>
    </div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文