Jump to content
php.lv forumi

position fixed iekšs diva


Recommended Posts

Posted

divu, ko gribi dabūt vienmēr apakšā:

position:absolute;

bottom:0px;

 

un tad vecākam uzliec paddingu no apakšas tik cik ir tas apakšējā div'a augstums, lai teksts nepalien zem paša div'a.

<div style="padding-bottom:20px; position:relative;">

<p>Saturs</p>

<div style="position:absolute;bottom:0;height:20px;">Apakša</div>

</div>

Posted

Nu tas skaidrs, bet ir nepieciešams tā, ka, ja ir maza izvēlne, tad šī izvēlne staigā kā position:fixed. Attiecīgi, ja nav sasniegts diva beigas, tad viņa staigā pa visu divu browsera apakšā. Pašlaik ir tā, ka uzliekot fullscreen vai lielāku rezolūciju šis #bottom ir pašā browsera apakšā un tas vairs neder.

Posted

samočiju kkā tā. Pagaidām viss šancē

function bottom_fixed() {
if($(window).height() > 800) {
 	$("#bottom").css("position", "relative");
 	$("#bottom").css("bottom", "30px");
}
else {
 	$("#bottom").css("position", "fixed");
 	$("#bottom").css("bottom", "0px");
}
}
$(document).ready(function() {
bottom_fixed();
});
$(window).scroll(function() {
bottom_fixed();
});
$(window).resize(function() {
bottom_fixed();
});

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...