I have been cracking my head over this one for so many hours now in vain .. Your help is SOOO appreciated.

I'm creating a website for a friend. I usually don't use Ajax, but he purchased this template and asked me to do the modifications needed. Everything is going well, until I reached this point.

There's a gallery, and my friend wants something unique. What I want to achieve at the moment is, When a member clicks an image, it opens a page in Iframe.

I want this Iframe to cover the website, like it's an independent page (Like a layer).

I used Jquery for this purpose. I have the Iframe Container div in place. When a member clicks the image.. the Iframe div becomes visible covering the viewport.

Here's the website page.

http://weahub.com/HH2/Nature.php

It works exactly as I need it in FireFox. But on Chrome it acts differently. You can probably view the page source / CSS in your browser, but I will share the codes below.

index.php :

<!DOCTYPE HTML>

<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title>Hamada Hajuj | Photographer Portfolio</title>

    <link rel="shortcut icon" href="img/fi.ico" type="image/x-icon" />
    <meta name="description" content="Your description">
    <meta name="keywords" content="Your keywords">
    <meta name="author" content="Your name">

    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/style.css">

    <link rel="stylesheet" type="text/css" href="HoverEffect/css/style.css" />

    <script type="text/javascript" src="js/jquery.js"></script> 
    <script type="text/javascript" src="js/device.js"></script> 
    <script type="text/javascript" src="js/bootstrap.js"></script>  
    <script type="text/javascript" src="js/core.js"></script>
    <script type="text/javascript" src="js/script.js"></script> 

    <script type="text/javascript" src="HoverEffect/js/modernizr.custom.72835.js"></script>

    <!--[if lt IE 9]>
        <div style='text-align:center'><a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." /></a></div>  
    <![endif]-->
</head>


<body id="mainBody">

<script>
function closeImage() {
    $('#iframeContainer').fadeOut('normal');
    $('#iframeClose').fadeOut('normal');
    $('#mainBody').css("overflow-y", "scroll");
}
</script>

<div id="iframeContainer"></div>
<div id="iframeClose"><a onclick="closeImage();">Back to Gallary</a></div>



<div id="webSiteLoader"></div>
<div id="glob-wrap">
    <!-- end fullscreen gallery -->
    <div id="imgSpinner"></div>
    <a href="#" id="prevButton"></a>
    <a href="#" id="nextButton"></a>
    <div id="galleryHolder">
        <div id="imageHolder">
            <img src="img/bg_pic2.jpg" alt="" data-image-align="top_right">
        </div>
    </div>
    <div id="inner">
        <ul>
            <li><a href="img/bg_pic2.jpg" data-image-align="top_right"></a></li>                  
            <li><a href="img/bg_pic3.jpg" data-image-align="top_left"></a></li>                  
            <li><a href="img/bg_pic1.jpg" data-image-align="top_right"></a></li>                  
            <li><a href="img/bg_pic4.jpg"></a></li>                  
            <li><a href="img/bg_pic5.jpg"></a></li>                  
        </ul>
    </div>
    <!-- end fullscreen gallery -->
    <header>
        <div class="container">
            <!--logo and company name-->  
            <h1><a href="/" class="navbar-brand"><img src="img/logo.png" class="img-responsive" alt="Hamada Hajuj Photographer Portfolio"></a></h1>
            <!--menu-->   
            <nav class="navbar navbar-default" role="navigation"> 
                <div class="navbar-header"> 
                    <nav id="mainNav" data-follow="location" data-type="navigation">
                        <ul>
                            <li><a href="/"></a></li>
                            <li><a href="/gall.php">gallery</a>
                                <div class="sf-mega">
                                    <ul>
                                        <li><a href="#">Urban City</a></li>
                                        <li><a href="#">Studio Modeling</a></li>
                                        <li><a href="#">People</a></li>
                                        <li class="last"><a href="Nature.php">Nature</a></li>

                                    </ul>
                                </div>
                            </li>
                            <li><a href="/about.php">about me</a></li>

                            <li><a href="/blog.php">blog</a></li>

                            <li><a href="/contacts.php">contacts</a></li>
                        </ul>
                    </nav>
                </div>
            </nav>
        </div>
    </header>
    <article id="content" data-follow="location" data-type="switcher">
    </article>




    <div id="other_pages" class="container" data-follow="location" data-type="switcher" data-flags="ajax">
        <?php /*
        <!--<div id="gallery" data-id="gallery"></div>-->
        */?>
    </div>
    <footer>
        <ul class="soc_links follow-links">
            <li><a href="#" class="facebook"><img src="img/soc_icon1.png" alt=""></a></li>
            <li><a href="#" class="googleplus"><img src="img/soc_icon2.png" alt=""></a></li>
            <li><a href="#" class="twitter"><img src="img/soc_icon3.png" alt=""></a></li>
        </ul>
        <div class="copyright">&copy; <span id='year'></span> &bull; <a href="/privacy.php">privacy policy</a><br><!-- {%FOOTER_LINK} --></div>
    </footer>
</div>

</body>

ajax/Nature.php :

<!doctype html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Contacts</title>
</head>
<body>

        <div class="container">
            <div class="row">
                <div class="col-lg-10 col-lg-offset-1" style="float:center;">
                <h3 style="margin-top:-20px; margin-bottom:20px;">Gallery --> Nature</h3>


<script>
function loadImage(id) {
    document.getElementById('iframeContainer').innerHTML='<iframe class="imageIframe" src="http://akramabdulfattah.com"></iframe>';
    var width=$( window ).width();
    var height=$( window ).height();
    $("#iframeContainer").css("width", width);
    $("#iframeContainer").css("height", height);
    $("#mainBody").css("overflow-y", "hidden");
    $("#iframeContainer").fadeIn(0500);
    $("#iframeClose").fadeIn(0500); 
}

</script>               

                        <a onclick="loadImage(123);"><img src="Photos/Nature_Pic1_Thumbnail.jpg" alt="Nature Image 1" class="thumbImage"><div class="hover"><span class="icon"></span></div></a><br>
                        <a onclick="loadImage(123);"><img src="Photos/Nature_Pic1_Thumbnail.jpg" alt="Nature Image 1" class="thumbImage"><div class="hover"><span class="icon"></span></div></a>

                </div>
            </div>

        </div>

</body>
</html>

and in my style sheet I have this (concerning this activity) :

/*IFrame for images */
#iframeContainer {
   position: fixed !important;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  display:none;
  z-index: 8000;
}

.imageIframe {
    z-index:8000;
    height:100%;
    width:100%;
}

#iframeClose {
    z-index:8010;
    position:fixed;
    top:0px;
    left:0px;
    display:none;
    color:white;
}

Things I have already tried : I read that Chrome changed few settings regarding rendering fixed position with Z-index, or using fixed position with transformed objects. I tried clear all transformation in Z and in 3D , didn't work, and tried do it with only fixed position (no z-index) and didn't work either. I tried some desperate solutions as well, not worth mentioning, and all I concluded is, Chrome is ignoring the fixed positioning for some reason that I can't figure out :(

your help is HIGHLY APPRECIATED.

Thank you very much in advance!!

有帮助吗?

解决方案

I think it's happening because of the "perspective" css properties you have your style.css file (it's not in the code you pasted, but it's in the source file on the site you linked to).

You can remove these lines in the style.css file:

perspective: 1000px;
-webkit-perspective: 1000px;
-moz-perspective: 1000px;
-o-perspective: 1000px;

I don't know what they are there for, but when I removed them it seemed to fix your issue without altering anything else that I could see.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top