Open In App

Semantic-UI Fly Transition

Semantic UI is an open-source framework that uses CSS and jQuery to build great user interfaces. It is the same as a bootstrap for use and has great different elements to use to make your website look more amazing. In this article, we are going to learn about Fly Transition.  

It is equipped with pre-built semantic components that help create responsive layouts using user-friendly HTML. An element can fly in or from off-canvas on clicking the button.



This method is used to control the way in which transition takes place between the two states of the element on click. We can even assign a specific direction for fly transition using direction i.e. up, down, right, or left. To add a fly transition to any div or HTML element in the Semantic UI. We use the .transition() function with the following parameters along with the “fly” parameter. This makes the element fly. 

Parameters Value:



Syntax: 

$('.image').transition('fly up'); 

Example 1: The below example illustrates the Semantic UI fly transition.




<!DOCTYPE html>
<html>
  
<head>
    <title>Semantic UI</title>
    <link href=
          rel="stylesheet" />
        integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
        crossorigin="anonymous">
    </script>  
    
    <script src=
    </script>
</head>
  
<body>
    <center>
        <h1 class="ui header green">GeeksforGeeks</h1>
        <strong>Semantic UI Fly Transitions</strong>   
      
        <div class="ui container">        
            <img class="ui image medium"
                 src=
            <br/>
            <button class="ui button">
                Click here!!
            </button>            
        </div>
    </center>
  
    <script>
        $('button').click(function () {
            $('.image').transition('fly');
        })
    </script>
</body>
</html>

Output:

Semantic-UI Fly Transition

Example 2: The following code demonstrates the fly transition in the “up” direction.




<!DOCTYPE html>
<html>
  
<head>
    <title>Semantic UI</title>
    <link href=
          rel="stylesheet" />
        integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
        crossorigin="anonymous">
    </script>   
   
    <script src=
    </script>
</head>
  
<body>
    <center>
        <h1 class="ui header green">GeeksforGeeks</h1>
        <strong>Semantic UI Fly Transitions</strong>   
      
        <div class="ui container">                
            <img class="ui image medium"
                 src=
            <br/>
            <button class="ui button">
                Click here!!
            </button>            
        </div>
    </center>
  
    <script>
        $('button').click(function () {
            $('.image').transition('fly up');
        })
    </script>
</body>
</html>

Output:

Semantic-UI Fly Transition

Reference: https://semantic-ui.com/modules/transition.html#fly


Article Tags :