Open In App

Semantic-UI Scale Transition

Last Updated : 20 Feb, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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 scale transition.  

It is equipped with pre-built semantic components that help create responsive layouts using user-friendly HTML. This method is used to control the way in which transition takes place between the two states of the element.

An element can scale into or out of view while the transition takes place by some event. 

Syntax:

 $('.image').transition('scale');

Example 1: The following code demonstrates the scale transition of the image.

HTML




<!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 Scale 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('scale');
        })        
    </script>
</body>
</html>


Output:

Semantic-UI Scale Transition

Semantic-UI Scale Transition

Example 2: The following example demonstrates the scale transition on the image hover event by the user as shown in the output.

HTML




<!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 Scale Transitions</strong>    
      
        <div class="ui container">                
            <img class="ui image medium" src=
            <br/>
            <button class="ui button">
                Click here!!
            </button>        
        </div>
    </center>
      
    <script>
        $('img').hover(function () {
            $('.image').transition('scale');
        })
    </script>
</body>
</html>


Output:           

Semantic-UI Scale Transition

Semantic-UI Scale Transition

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



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads