This article mainly introduces an example sharing of using CSS to create graphic deformation pop-up effects. The size of the pop-up window can be modified using jQuery. Friends who need it can refer to it.
Pop-up forms are commonly used on web pages. Interaction design, in this era that focuses on interactive animation experience, web pop-ups can also come up with some fresh ideas, such as the CSS deformation Modal Window shared today.
When the user clicks the button, the button will turn into a full-screen screen and then display the content. The entire display process is smooth and friendly. Maybe you can try it on your new project.
Demo page: http://codyhouse.co/gem/morphing-modal-window/
After clicking the "Fire Modal Window" button, the button will be slow Slowly increases the size until it reaches the entire screen. Here is a GIF demonstration:
Usage Tutorial
This code is compatible with Chrome, Firefox, Safari, Opera, and IE requires version 9.0 or above (IE9)
STEP 1: Create HTML layout
<section class="cd-section"> <!-- section content here --> <p class="cd-modal-action"> <a href="#0" class="btn" data-type="modal-trigger">Fire Modal Window</a> <!— 这是窗体按钮 --> <span class="cd-modal-bg"></span> </p> <p class="cd-modal"> <p class="cd-modal-content"> <!— 这是窗体内容区域 --> </p> </p> <a href="#0" class="cd-modal-close">Close</a> <!— 这是关闭按钮 --> </section>
STEP 2: Add CSS style
.cd-modal-action { position: relative; } .cd-modal-action .btn { width: 12.5em; height: 4em; background-color: #123758; border-radius: 5em; transition: color 0.2s 0.3s, width 0.3s 0s; } .cd-modal-action .btn.to-circle { width: 4em; color: transparent; transition: color 0.2s 0s, width 0.3s 0.2s; } .cd-modal-action .cd-modal-bg { position: absolute; top: 0; left: 50%; transform: translateX(-2em); width: 4em; height: 4em; background-color: #123758; border-radius: 50%; opacity: 0; visibility: hidden; transition: visibility 0s 0.5s; } .cd-modal-action .cd-modal-bg.is-visible { opacity: 1; visibility: visible; }
STEP 3: Add jQuery
This code uses jQuery. You can modify the window size through the following code.
var btnRadius = $('.cd-modal-bg').width()/2, left = $('.cd-modal-bg').offset().left + btnRadius, top = $('.cd-modal-bg').offset().top + btnRadius - $(window).scrollTop(), scale = scaleValue(top, left, btnRadius, $(window).height(), $(window).width()); function scaleValue( topValue, leftValue, radiusValue, windowW, windowH) { var maxDistHor = ( leftValue > windowW/2) ? leftValue : (windowW - leftValue), maxDistVert = ( topValue > windowH/2) ? topValue : (windowH - topValue); return Math.ceil(Math.sqrt( Math.pow(maxDistHor, 2) + Math.pow(maxDistVert, 2) )/radiusValue); }
The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
CSS to achieve the effect of text surrounding images
How to use css3 to implement a circular progress bar
Use CSS3 to write grayscale filters to create black and white photo effects
The above is the detailed content of Create graphic deformation pop-up effect with CSS. For more information, please follow other related articles on the PHP Chinese website!

在css中,可用list-style-type属性来去掉ul的圆点标记,语法为“ul{list-style-type:none}”;list-style-type属性可设置列表项标记的类型,当值为“none”可不定义标记,也可去除已有标记。

区别是:css是层叠样式表单,是将样式信息与网页内容分离的一种标记语言,主要用来设计网页的样式,还可以对网页各元素进行格式化;xml是可扩展标记语言,是一种数据存储语言,用于使用简单的标记描述数据,将文档分成许多部件并对这些部件加以标识。

在css中,可以利用cursor属性实现鼠标隐藏效果,该属性用于定义鼠标指针放在一个元素边界范围内时所用的光标形状,当属性值设置为none时,就可以实现鼠标隐藏效果,语法为“元素{cursor:none}”。

在css中,rtl是“right-to-left”的缩写,是从右往左的意思,指的是内联内容从右往左依次排布,是direction属性的一个属性值;该属性规定了文本的方向和书写方向,语法为“元素{direction:rtl}”。

在css中,可以利用“font-style”属性设置i元素不是斜体样式,该属性用于指定文本的字体样式,当属性值设置为“normal”时,会显示元素的标准字体样式,语法为“i元素{font-style:normal}”。

转换方法:1、给英文元素添加“text-transform: uppercase;”样式,可将所有的英文字母都变成大写;2、给英文元素添加“text-transform:capitalize;”样式,可将英文文本中每个单词的首字母变为大写。

在css3中,可以用“transform-origin”属性设置rotate的旋转中心点,该属性可更改转换元素的位置,第一个参数设置x轴的旋转位置,第二个参数设置y轴旋转位置,语法为“transform-origin:x轴位置 y轴位置”。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Notepad++7.3.1
Easy-to-use and free code editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.