Spec-Zone.ru › jQuery UI

Эффект масштабирования

Эффект масштабирования

Описание: Уменьшение или увеличение элемента на определённый процент.

  • scale

    • направление (по умолчанию: "both")
      Тип: Строка
      Направление эффекта. Возможные значения: "both", "vertical" или "horizontal".
    • начало (по умолчанию: [ "middle", "center" ])
      Тип: Массив
      Точка исчезновения.
    • процент
      Тип: Число
      Процент масштабирования.
    • масштабирование (по умолчанию: "both")
      Тип: Строка
      Какие области элемента будут изменены в размере: "both", "box", "content". Масштабирование по области включает рамку и отступы элемента; масштабирование по содержимому изменяет размер содержимого внутри элемента.

Примеры:

Переключить div с помощью эффекта масштабирования.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>scale demo</title>
  <link rel="stylesheet" href="https://code.jquery.com/ui/1.13.3/themes/smoothness/jquery-ui.css">
  <style>
  #toggle {
    width: 100px;
    height: 100px;
    background: #ccc;
  }
  </style>
  <script src="https://code.jquery.com/jquery-3.7.1.js"></script>
  <script src="https://code.jquery.com/ui/1.13.3/jquery-ui.js"></script>
</head>
<body>
 
<p>Click anywhere to toggle the box.</p>
<div id="toggle"></div>
 
<script>
$( document ).click(function() {
  $( "#toggle" ).toggle( "scale" );
});
</script>
 
</body>
</html>

Демо:

Переключить div с помощью эффекта масштабирования только в одном направлении.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>scale demo</title>
  <link rel="stylesheet" href="https://code.jquery.com/ui/1.13.3/themes/smoothness/jquery-ui.css">
  <style>
  #toggle {
    width: 100px;
    height: 100px;
    background: #ccc;
  }
  </style>
  <script src="https://code.jquery.com/jquery-3.7.1.js"></script>
  <script src="https://code.jquery.com/ui/1.13.3/jquery-ui.js"></script>
</head>
<body>
 
<p>Click anywhere to toggle the box.</p>
<div id="toggle"></div>
 
<script>
$( document ).click(function() {
  $( "#toggle" ).toggle({ effect: "scale", direction: "horizontal" });
});
</script>
 
</body>
</html>

Демо:

© The jQuery Foundation and other contributors
Licensed under the MIT License.
https://api.jqueryui.com/scale-effect

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API