tags:

views:

153

answers:

2

Hi there, 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"&gt;
<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

+1  A: 

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?

David Thomas
I'm shooting for that rounded corners look, I thought this would be a relatively easy way to achieve that.
ivannovak
+1  A: 

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 :)

jakeisonline
Good answers man! I had just completed slicing and implementing that (successfully) when I refreshed the page to see your comment. I had thought about the 3rd layer of JS, but I'm not confident enough with it yet to be able to do that quickly. Thanks a bunch!
ivannovak
I think the CSS approach would be much easier anyway, as you won't run into problems with z-index in older browsers, let us know if it all works out!
jakeisonline