2017-03-22 4 views
0

Ich möchte, dass wenn ich das Element nach scroll mit negativem Rand dieses nicht "Sprung" beheben. Beispiel ->https://jsfiddle.net/uxhgpz6e/2/CSS fix Div nach Scroll mit negativem Randsprung

enter code here.header-body { 
    background: #339CCC; 
    border-top: 5px solid #EDEDED; 
    border-bottom: 1px solid transparent; 
    width: 100%; 
    z-index: 1001; 
    padding-top:90px; 
    transition: all 5s ease; 
}` 

(I akzentuierte das Verhalten mit dem Übergang)

Antwort

1

Ich bin nicht ganz sicher, was Sie würde versuchen zu erreichen, aber diese Arbeit ?: https://jsfiddle.net/m9oqbuab/1/

Im Wesentlichen es ist immer behoben. Hinzugefügt Folgendes css unter .header-body:

.header-body { 
    background: #339CCC; 
    border-top: 5px solid #EDEDED; 
    border-bottom: 1px solid transparent; 
    width: 100%; 
    z-index: 1001; 
    padding-top:90px; 
    transition: all 5s ease; 
    position: fixed; 
} 

Danach entfernten die css('position') Methoden aus der js.

+0

ah ma sei italiano? ascolta, ma se volessi wagen un effetto all'header-body kommen in questo sito? -> http://preview.oklerthemes.com/?theme=Porto ... cioè prima usa un relativ pro weit vedere che scorre ... poi usare il fixiert .. però se metto il fixed si vede salta alla posizione originale pro POI tornare su. Ecco, ivo vorrei evite di vedere queso effetto salto, ma usare in zeitgleiche la combinazione relative + fixed. - @dLorenzo – July

+0

[link] http://stackoverflow.com/questions/42954043/css-combination-of-relativefixed-without-jump-effect – July