94451
May 21, 2015
1604
2
0
Position Absolut in Div einsperren jQUERY
Hallo Ihr,
ich habe hier "Fertigen" Code nur minimal verändert genau so aus dem Netz:
das ganze script macht mir so schöne Dots wie man sie von WindowsPhone kennt.
Diese werden wegen Position Absolut ganz oben angezeigt.
jetzt möchte ich diese aber "nur bei bedarf" einblenden:
okay das ist nicht schwer:
jetzt zu meinem Problem ich will das es genau in dem DIV (meiner wahl) oben am Rand und nicht im Body oben am Rand erscheind:
jetzt Fehlt nur noch, das er die Positionierung übernimmt...
Wenn ich die Positionierung relativ mach, macht er meine dots auch "untereinander :/"
Vielen Dank
ich habe hier "Fertigen" Code nur minimal verändert genau so aus dem Netz:
<div id="meinFeld" style="border: 1px solid #f30; width: 220px; height: 30px; "></div>
<div id="Loading">
<div id="dotContainer">
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
</div>
</div>
<style>
#dotContainer .dot {
position: absolute;
top: 0;
width: 7px;
height: 7px;
margin-left: -5px;
background-color: rgba(0, 176, 240, 0.7);
border-radius: 2px;
left: 0;
}
</style>
<script>
var loading;
$(document).ready(function() {
loading = true;
$(".dot").each(function(index) {
moveDot($(this), index);
});
});
function sinh(aValue) {
var myTerm1 = Math.pow(Math.E, aValue);
var myTerm2 = Math.pow(Math.E, -aValue);
return (myTerm1-myTerm2)/2;
}
$.easing.speedInOut = function(x, t, b, c, d) {
return (sinh((x - 0.5) * 5) + sinh(-(x - 0.5)) + (sinh(2.5) + Math.sin(-2.5))) / (sinh(2.5) * 1.82);
};
function moveDot(dotItem, delay) {
if (loading){
dotItem.delay(delay * 200).css('left', '0%').animate({
left: '100%'
}, 2000, 'speedInOut', function() {
moveDot(dotItem, 0);
});
}
}
</script>
das ganze script macht mir so schöne Dots wie man sie von WindowsPhone kennt.
Diese werden wegen Position Absolut ganz oben angezeigt.
jetzt möchte ich diese aber "nur bei bedarf" einblenden:
okay das ist nicht schwer:
$("#Loading").css({"display": "none" })
bzw. display blockjetzt zu meinem Problem ich will das es genau in dem DIV (meiner wahl) oben am Rand und nicht im Body oben am Rand erscheind:
$("#meinFeld").html( $("#Loading").html() )
jetzt Fehlt nur noch, das er die Positionierung übernimmt...
Wenn ich die Positionierung relativ mach, macht er meine dots auch "untereinander :/"
Vielen Dank
Please also mark the comments that contributed to the solution of the article
Content-Key: 272522
Url: https://administrator.de/contentid/272522
Printed on: April 25, 2024 at 12:04 o'clock
2 Comments
Latest comment