Skip to content

Instantly share code, notes, and snippets.

@bkoopman
Last active December 17, 2015 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bkoopman/5662397 to your computer and use it in GitHub Desktop.
Save bkoopman/5662397 to your computer and use it in GitHub Desktop.
/*
* Experience Manager show/hide
*/
(function ($, window, i) {
$.fn.xpmShowHide = function (options) {
return this.each(function () {
i++;
var $this = $(this);
if (window.self === window.top) {
// not in a frame
$this.hide();
} else {
// in a frame (probably experience manager)
$this.show();
}
});
}
})(jQuery, this, 0);
$(document).ready(function() {
// show or hide elements specifically for experience manager
$(".xpm-only").xpmShowHide();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment