MyStack
MyStack

Reputation: 53

Bootstrap welcome popup and hover

I need a little help to create this. My idea is to have a welcome popup on my web page. When the user firstly loaded the site. [image.1

And after few seconds i need to place this image on top right corner of the site. like this image.2

How can i do this by using bootstrap css. Please help me :)

Upvotes: 0

Views: 878

Answers (1)

Tuomas Koivisto
Tuomas Koivisto

Reputation: 54

This is with Bootstrap 4 and JQuery. JQuery slim changed to min to allow animations. Run the code snippet.

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
      
      <style>
          img {
              width: 100%;
              width: 100%;
              position: relative;
              float: right;
          }
      </style>

    <title>Hello, world!</title>
  </head>
  <body>
    <img src="https://i.sstatic.net/Jrbqf.png">

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script
  src="https://code.jquery.com/jquery-3.3.1.min.js"
  integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
  crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
      <script>
          
        $( document ).ready(function() {
            $('img')
                .hide()
                .fadeIn(1000)
                .delay(2000)
                .animate({
                    width: "50%",
                    height: "50%"
                }, 1500);
        });
      </script>
  </body>
</html>

Upvotes: 2

Related Questions