Advertisement
lemansky

Untitled

Nov 12th, 2021
775
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.96 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Document</title>
  6.     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7.     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
  8.     <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">
  9.     <script>
  10.         document.addEventListener('DOMContentLoaded', function(event){
  11.             // clean(document.body);
  12.  
  13.             let btns = document.querySelectorAll('.close');
  14.             btns.forEach(item => {
  15.                 item.addEventListener('click', (e) => {
  16.                     // e.target.parentNode.classList.add('p-5');
  17.                     e.target.parentNode.remove();
  18.                 });
  19.             });
  20.  
  21.         });
  22.         const clean = (node) =>
  23.         {
  24.           for(var n = 0; n < node.childNodes.length; n ++)
  25.          {
  26.            var child = node.childNodes[n];
  27.            if
  28.            (
  29.              child.nodeType === 8
  30.              ||
  31.              (child.nodeType === 3 && !/\S/.test(child.nodeValue))
  32.            )
  33.            {
  34.              node.removeChild(child);
  35.              n --;
  36.            }
  37.            else if(child.nodeType === 1)
  38.            {
  39.              clean(child);
  40.            }
  41.          }
  42.        }
  43.     </script>
  44.     <style>
  45.         .media{
  46.             position:relative;
  47.  
  48.         }
  49.         .media-object{
  50.             border-radius:5px;
  51.         }
  52.         .close{
  53.             position:absolute;
  54.             top:0;
  55.             right:5px;
  56.         }
  57.     </style>
  58. </head>
  59. <body>
  60.  
  61.     <div class="container" style="margin-top:50px">
  62.         <div class="row">
  63.             <div class="col-md-6 col-lg-6">
  64.                 <ul class="media-list main-list">
  65.                   <li class="media border-info card">
  66.                     <a class="pull-left" href="#">
  67.                       <img class="media-object" src="http://placehold.it/500x100" alt="...">
  68.                     </a>
  69.                     <div class="card-body">
  70.                       <h4 class="card-heading">Lorem ipsum dolor asit amet 1</h4>
  71.                       <p class="by-author">By John Doe</p>
  72.                     </div>
  73.                     <a href="#" class="close">x</a>
  74.                   </li>
  75.                   <li class="media border-info card">
  76.                     <a class="pull-left" href="#">
  77.                       <img class="media-object" src="http://placehold.it/500x100" alt="...">
  78.                     </a>
  79.                     <div class="card-body">
  80.                       <h4 class="card-heading">Lorem ipsum dolor asit amet 2</h4>
  81.                       <p class="by-author">By Jane Doe</p>
  82.                     </div>
  83.                     <a href="#" class="close">x</a>
  84.                   </li>
  85.                   <li class="media border-info card">
  86.                     <a class="pull-left" href="#">
  87.                       <img class="media-object" src="http://placehold.it/500x100" alt="...">
  88.                     </a>
  89.                     <div class="card-body">
  90.                       <h4 class="card-heading">Lorem ipsum dolor asit amet 3</h4>
  91.                       <p class="by-author">By Johnson Doe</p>
  92.                     </div>
  93.                     <a href="#" class="close">x</a>
  94.                   </li>
  95.                 </ul>
  96.             </div>
  97.         </div>
  98.     </div>
  99.  
  100.  
  101. </body>
  102. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement