How to create a sticky left sidebar menu using bootstrap 3?

Bootstrap 3 Here is a working left sidebar example: http://bootply.com/90936 (similar to the Bootstrap docs) The trick is using the affix component along with some CSS to position it: #sidebar.affix-top { position: static; margin-top:30px; width:228px; } #sidebar.affix { position: fixed; top:70px; width:228px; } EDIT– Another example with footer and affix-bottom Bootstrap 4 The Affix component … Read more

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

What are `scrolling boxes`?

As @alex said a scrolling box is a box where the value of overflow is set to a value different from visible (the default one). I cannot confirm but I concluded this based on this previous answer where overflow is creating some issues with sticky element. As I explained there, if you have an element … Read more

If you specify `bottom: 0` for position: sticky, why is it doing something different from the specs?

According to the MDN, fixed position elements are treated as relative position elements until the specified threshold is exceeded It’s all a matter of language here because the above sentence doesn’t mean the element will necesseraly start position:relative then become fixed. It says until the specified threshold is exceeded. So what if initially we have … 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