force footer on bottom on pages with little content

This Flexbox solution is neater and far easier to implement: HTML <body> <div class=”content”> content </div> <footer class=”footer”></footer> </body> CSS html, body { height: 100%; } body { display: flex; flex-direction: column; } .content { flex: 1 0 auto; } .footer { flex-shrink: 0; } Just ensure you wrap the necessary divs inside the body.

Make a nav bar stick

$(document).ready(function() { $(window).scroll(function () { //if you hard code, then use console //.log to determine when you want the //nav bar to stick. console.log($(window).scrollTop()) if ($(window).scrollTop() > 280) { $(‘#nav_bar’).addClass(‘navbar-fixed’); } if ($(window).scrollTop() < 281) { $(‘#nav_bar’).removeClass(‘navbar-fixed’); } }); }); html, body { height: 4000px; } .navbar-fixed { top: 0; z-index: 100; position: fixed; width: … Read more

Sticky top div with absolute positioning

2018-6-18 I choose the CSS way with position: sticky. that https://github.com/abouolia/sticky-sidebar . doesn’t work for me (I am using Vue.js 2.0 SPA with vue-router & vuex) I also want the element position: absolute first, and then position: sticky Solution parent HTML element use position: absolute to have the right position. (don’t forget to set height … Read more

START_STICKY does not work on Android KitKat

Seems that this is a bug present in Android 4.4, got around it with the following: @Override public void onTaskRemoved(Intent rootIntent) { Intent restartService = new Intent(getApplicationContext(), this.getClass()); restartService.setPackage(getPackageName()); PendingIntent restartServicePI = PendingIntent.getService( getApplicationContext(), 1, restartService, PendingIntent.FLAG_ONE_SHOT); AlarmManager alarmService = (AlarmManager)getApplicationContext().getSystemService(Context.ALARM_SERVICE); alarmService.set(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() +1000, restartServicePI); } Found this answer from this post

Pros and Cons of Sticky Session / Session Affinity load blancing strategy?

Pros: It’s easy– no app changes required. Better utilizes local RAM caches (e.g. look up user profile once, cache it, and can re-use it on subsequent visits from same user) Cons: If the server goes down, session is lost. (Note that this is a con of storing session info locally on the web server, not … Read more

pure CSS multiple stacked position sticky?

You need to make all the elements to stick to the same container (containing block) by adding some offsets. Here is a basic example where the elements will stick to the body: body { margin:0; min-height:200vh; border:2px solid; } .first { height:50px; background:red; position:sticky; top:0; } .second { height:50px; background:blue; position:sticky; top:52px; } .third { … Read more