Spec-Zone.ru › jQuery Mobile

jQuery.mobile.getInheritedTheme()

jQuery.mobile.getInheritedTheme( el, defaultTheme )Возвращает: Строкуверсия устаревшая: 1.4.0

Описание: Извлекает тему ближайшего родителя, которому назначена тема.

  • jQuery.mobile.getInheritedTheme( el, defaultTheme )

    • el
      Тип: jQuery
      Объект jQuery-коллекции, содержащий элемент, для которого требуется определить унаследованную тему.
    • defaultTheme
      Тип: Строка
      Схема цветов (палитра), которая применяется, если тема не найдена ни у одного из родителей. Принимает одиночную букву от a до z, которая отображается в палитрах, включенных в вашу тему.

      Возможные значения: буква палитры (a-z).

Этот метод больше не нужен, так как наследование тем полностью реализовано в CSS начиная с jQuery Mobile 1.4.0.

Пример:

Извлечение унаследованной темы для элемента

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery.mobile.getInheritedTheme demo</title>
  <link rel="stylesheet" href="//code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
  <script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
  <script src="//code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
 
  <script>
  $.mobile.document.on( "click", "#check-theme", function() {
    alert( "I inherit theme '" +
      $.mobile.getInheritedTheme( $( this ), "x" ) + "'" );
  });
  </script>
  <div data-role="header">
    <h2>jQuery Mobile Example</h2>
  </div>
  <div role="main" class="ui-content">
    <p>Click the button below to find out what theme it inherits.</p>
    <a href="#" id="check-theme" class="ui-btn ui-corner-all ui-shadow">Check my theme</a> 
  </div>
 
</body>
</html>

Демо:

© The jQuery Foundation and other contributors
Licensed under the MIT License.
https://api.jquerymobile.com/jQuery.mobile.getInheritedTheme

Spec-Zone.ru

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