JQuery inserts a layer on top of existing content

I am trying to create a new layer on top of existing content on my site when I click a link / button. I am using jquery, but the code that I have does not seem to work properly.

Here is what I have:

 $(document).ready(function(){
  $("#button").click(function () {
  $("#showme").insertAfter("#bodytag")
  $("#showme").fadeIn(2000);
});

});

The effect I need is to <div id="showme">...</div>display directly after the # bodytag. <div id="showme">...</div>has a z-index higher than anything else on the site, so it should just appear above the content immediately after # bodytag.

Thanks for the help.

+3
source share
2 answers

, div, #showme, position: relative, #showme : . , .

, - $() - $(document), jQuery:

$().ready(function(){
  $("#button").click(function () {
    $("#showme").insertAfter("#bodytag").fadeIn(2000);
  });
});
+2

, #showme position static.

0

Source: https://habr.com/ru/post/1698537/


All Articles