jQuery Set DOM Element to Top View Z-Index

jQuery.fn.mb_bringToFront= function(zIndexContext){
  var zi=1;
  var els= zIndexContext && zIndexContext!="auto" ? $(zIndexContext): $("*");
  els.not(".alwaysOnTop").each(function() {
    if($(this).css("position")!="static"){
      var cur = parseInt($(this).css('zIndex'));
      zi = cur > zi ? parseInt($(this).css('zIndex')) : zi;
    }
  });
  $(this).not(".alwaysOnTop").css('zIndex',zi+=1);
  return zi;
};
//jQuery function to Set any DOM Element to Top View (bring to front) using CSS Z-Index property.

Leave a Reply