Note that there are some explanatory texts on larger screens.

plurals
  1. POPositioning issue in chrome with fixed positioned flexslider and sticky navigation
    primarykey
    data
    text
    <p>I have a web page with fixed positioned flexslider. I use following code to make flexslider fixed position and to add the slider as the background.</p> <pre><code>.flexslider { display: block; position: fixed; left: 0; top: 0; overflow: hidden; height: 100%; width: 100%; z-index: -1; border: none; } </code></pre> <p>and the webpage has a sticky navigation which becomes fixed positioned when the user scroll to top height of half of the the viewport height. I did this by using following jQuery and CSS:</p> <p>jQuery:</p> <pre><code> $(window).scroll(function() { var scrollTop = $(window).height()/2; if ($(window).scrollTop() &gt;= scrollTop) { $('.main-header').removeClass('main-header ').addClass('fixed-header'); } if ($(window).scrollTop() &lt; scrollTop) { $('.fixed-header').removeClass('fixed-header').addClass('main-header '); } }) </code></pre> <p>CSS:</p> <pre><code>.fixed-header { position: fixed; top: 0; left: 0; } </code></pre> <p>and my html markup is:</p> <pre><code> &lt;div class="flexslider"&gt; &lt;ul class="slides"&gt; &lt;li&gt; &lt;img src="images/image1.jpg" /&gt; &lt;/li&gt; &lt;li&gt; &lt;img src="images/image2.jpg" /&gt; &lt;/li&gt; &lt;li&gt; &lt;img src="images/image3.jpg" /&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;header class="main-header"&gt; &lt;h1&gt;heading&lt;/h1&gt; &lt;p&gt; paragraph &lt;/p&gt; &lt;nav class="site-navigation"&gt; &lt;ul&gt; &lt;li&gt; &lt;a class="active" href="#slide1"&gt;home&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#slide2"&gt;about&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#slide3"&gt;services&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#slide4"&gt;contact&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#slide5"&gt;elements&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; &lt;/header&gt; </code></pre> <p>The issue is the navigation does not become fixed and it goes up when it scroll in chrome. If I change the fixed position of flexslider it works fine. This code work perfectly in all the major browsers except Chrome. </p> <p>How to fix this issue and Is there another way to design a sticky navigation?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload