Advertisement
FastJava

html button lol

Apr 27th, 2024
979
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.38 KB | Writing | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.    <link rel="stylesheet" href="styles.css">
  5.    <script src="script.js"></script>
  6. </head>
  7. <body>
  8.    <button class="my-button" data-image-link="https://example.com/image.png">
  9.       Click me
  10.    </button>
  11. <!--- css --->
  12. <style>
  13. .my-button {
  14.    background-color: #4CAF50;
  15.    color: white;
  16.    padding: 15px 32px;
  17.    text-align: center;
  18.    text-decoration: none;
  19.    display: inline-block;
  20.    font-size: 16px;
  21.    margin: 4px 2px;
  22.    cursor: pointer;
  23.    position: relative;
  24.    overflow: hidden;
  25. }
  26.  
  27. .my-button:before {
  28.    content: "";
  29.    position: absolute;
  30.    top: 0;
  31.    left: 0;
  32.    width: 100%;
  33.    height: 100%;
  34.    background-image: url('placeholder.png');
  35.    background-size: cover;
  36.    background-position: center;
  37.    transition: transform 0.3s ease;
  38.    transform: translateX(-100%);
  39. }
  40.  
  41. .my-button:hover:before {
  42.    transform: translateX(0);
  43. }
  44. </style>
  45.  
  46. <!--- javascript --->
  47.  
  48. <script>
  49. document.querySelector('.my-button').addEventListener('click', function() {
  50.    const imageLink = this.getAttribute('data-image-link');
  51.    const iframe = document.createElement('iframe');
  52.    iframe.src = imageLink;
  53.    iframe.width = '640';
  54.    iframe.height = '360';
  55.    iframe.style.border = 'none';
  56.    iframe.style.overflow = 'hidden';
  57.    iframe.style.marginLeft = '-200px';
  58.    document.body.appendChild(iframe);
  59. });
  60. </script>
  61.  
  62. im lol 😂
Tags: html lol button
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement