如何添加“框架”图像 (png) 且不失去交互性

发布于 2024-08-06 02:43:46 字数 3495 浏览 4 评论 0原文

我想在 kwicks 图像滑块上添加一个 png 框架,但是当我这样做时,我失去了交互性。

如何在元素上添加 png 框架而不丢失下面元素的交互性?

您可以在此处查看示例:www.jujumamablog.com/jujumama/dev.html

以下是开发页面的代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
    <head>
        <title>Kwicks Examples: Example 1</title>
        <script src="http://jmar777.googlecode.com/svn/trunk/js/jquery-1.2.6.js" type="text/javascript"></script>
        <script src="http://jmar777.googlecode.com/svn/trunk/js/jquery.easing.1.3.js" type="text/javascript"></script>

        <script src="http://kwicks.googlecode.com/svn/branches/v1.5.1/Kwicks/jquery.kwicks-1.5.1.pack.js" type="text/javascript"></script>
                <style type="text/css">

        /* defaults for all examples */
        .kwicks {
            list-style: none;
            position: relative;
            margin: 5px 0;
            padding: 0;
        }
        .kwicks li{
            display: block;
            overflow: hidden;
            padding: 0;
            cursor: pointer;
        }

        /* example 1 */
        #example1 .kwicks li{
            float: left;
            width: 96px;
            height: 200px;
            margin-right: 2px;
        }
        #example1 #kwick1 { 
            background-color: #53b388;
        }
        #example1 #kwick2 {
            background-color: #5a69a9;
        }
        #example1 #kwick3 {
            background-color: #c26468;
        }
        #example1 #kwick4 { 
            background-color: #bf7cc7;
        }
        #example1 #kwick5 { 
            background-color: #bf7cc7;
            margin-right: none;
        }
        #sliderFrame{
            background: transparent url('sliderFrame.png') no-repeat scroll 0 0;
            display: block;
            height: 206px;
            position: absolute;
        //  top: 150px;
            width: 504px;
            z-index: 99;
            margin-top: -4px;

        }
        </style>

    <script type="text/javascript">
        $().ready(function() {
            $('.kwicks').kwicks({
                max : 205,
                spacing : 5
            });
        });
    </script>

    </head>

    <body>

            <div id="example1">
            <div id="sliderFrame"></div> <!-- This blocks ineteractivity -->
                <ul class="kwicks">

                    <li id="kwick1"></li>
                    <li id="kwick2"></li>
                    <li id="kwick3"></li>
                    <li id="kwick4"></li>
                    <li id="kwick5"></li>
                </ul>
            </div>
            <div style="clear:both;"></div>

            <div id="example1">
                <ul class="kwicks">

                    <li id="kwick1"></li>
                    <li id="kwick2"></li>
                    <li id="kwick3"></li>
                    <li id="kwick4"></li>
                    <li id="kwick5"></li>
                </ul>
            </div>
            <div style="clear:both;"></div>

    </body>
</html>

提前致谢

I'd like to add a png frame over a kwicks image slider, but when I do, I lose the interactivity.

How can I add a png frame over an element without losing the interactivity of the element below?

You can see the example here: www.jujumamablog.com/jujumama/dev.html

Below is the code for the dev page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
    <head>
        <title>Kwicks Examples: Example 1</title>
        <script src="http://jmar777.googlecode.com/svn/trunk/js/jquery-1.2.6.js" type="text/javascript"></script>
        <script src="http://jmar777.googlecode.com/svn/trunk/js/jquery.easing.1.3.js" type="text/javascript"></script>

        <script src="http://kwicks.googlecode.com/svn/branches/v1.5.1/Kwicks/jquery.kwicks-1.5.1.pack.js" type="text/javascript"></script>
                <style type="text/css">

        /* defaults for all examples */
        .kwicks {
            list-style: none;
            position: relative;
            margin: 5px 0;
            padding: 0;
        }
        .kwicks li{
            display: block;
            overflow: hidden;
            padding: 0;
            cursor: pointer;
        }

        /* example 1 */
        #example1 .kwicks li{
            float: left;
            width: 96px;
            height: 200px;
            margin-right: 2px;
        }
        #example1 #kwick1 { 
            background-color: #53b388;
        }
        #example1 #kwick2 {
            background-color: #5a69a9;
        }
        #example1 #kwick3 {
            background-color: #c26468;
        }
        #example1 #kwick4 { 
            background-color: #bf7cc7;
        }
        #example1 #kwick5 { 
            background-color: #bf7cc7;
            margin-right: none;
        }
        #sliderFrame{
            background: transparent url('sliderFrame.png') no-repeat scroll 0 0;
            display: block;
            height: 206px;
            position: absolute;
        //  top: 150px;
            width: 504px;
            z-index: 99;
            margin-top: -4px;

        }
        </style>

    <script type="text/javascript">
        $().ready(function() {
            $('.kwicks').kwicks({
                max : 205,
                spacing : 5
            });
        });
    </script>

    </head>

    <body>

            <div id="example1">
            <div id="sliderFrame"></div> <!-- This blocks ineteractivity -->
                <ul class="kwicks">

                    <li id="kwick1"></li>
                    <li id="kwick2"></li>
                    <li id="kwick3"></li>
                    <li id="kwick4"></li>
                    <li id="kwick5"></li>
                </ul>
            </div>
            <div style="clear:both;"></div>

            <div id="example1">
                <ul class="kwicks">

                    <li id="kwick1"></li>
                    <li id="kwick2"></li>
                    <li id="kwick3"></li>
                    <li id="kwick4"></li>
                    <li id="kwick5"></li>
                </ul>
            </div>
            <div style="clear:both;"></div>

    </body>
</html>

Thanks in advance

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

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

发布评论

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

评论(2

苦笑流年记忆 2024-08-13 02:43:46

不幸的是,使用 z-index 来“分层”元素会导致下面的元素变得不可交互,但它们仍然明显可见。

因此,这里有两个选项:

  1. JavaScript - 与下面的彩色框(第 1 层)非常相似,在“圆角”图像(第 2 层)上放置另一个元素(第 3 层),但将背景设为背景-color:对于那些可交互的框来说是透明的,然后引用JavaScript来移动第一层框和第三层框。
  2. CSS - 对要在这些交互框中使用的圆角图像进行切片,并将它们用作背景图像。这将需要大量的工作、反复试验才能得到正确的结果,但这意味着不需要额外的 javascript 或搞乱 z-index。

希望有帮助,并且不会进一步混淆问题:)

Unfortunately using z-index to 'layer' elements will cause the below elements to become non-interactive, but they are still obviously visible.

Therefore, there's two options here:

  1. JavaScript - much like the coloured boxes below (layer 1), place a further element (layer 3) over the 'rounded corners' image (layer 2) but making the background-color: transparent for those interactable boxes, then referencing the JavaScript to move the 1st layer boxes as well as the 3rd layer boxes.
  2. CSS - slice the rounded corner image to be used within those interactive boxes, and use them as background images. This would be a fair amount of work, trial and error to get it right but would mean no extra javascript or messing around with z-index.

Hope that helps, and doesn't confuse matters further :)

香草可樂 2024-08-13 02:43:46

您无法将一个元素放置在另一个元素之上并保留较低级别的交互性。至少,不使用 Javascript 是不行的;我想不出一个插件或脚本可以实现你想要的。

您可以使用该图像作为您想要保留其功能的元素的某种形式的背景吗?

You can't place one element over another and retain the lower-level's interactivity. At least, not without using Javascript; and I can't think of a plugin or script that achieves what you want.

Could you use the image as some form of background for the element for which you want to retain the functionality?

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