.cssClip( [dimensions ] )
返回:jQuery
添加的版本:1.12
說明:CSS對象版本的getter/setterclip屬性。
- 
.cssClip( [dimensions ] )- 
dimensions類型:Object設置 CSSclip屬性時,指定top、right、bottom和left屬性以使用rect()樣式。
 
- 
例子:
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>cssClip demo</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
  <style>
  .clipped {
    position: absolute;
    width: 150px;
    height: 150px;
    background: #3b679e;
    background: linear-gradient(to bottom, #3b679e 0%, #2b88d9 50%, #207cca 51%, #7db9e8 100%);
  }
  </style>
  <script src="//code.jquery.com/jquery-1.12.4.js"></script>
  <script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<body>
 
Click anywhere!
<div class="clipped"></div>
 
<script>
var clippings = [
  {
    top: 10,
    right: 50,
    bottom: 50,
    left: 5
  },
  {
    top: 0,
    right: 150,
    bottom: 150,
    left: 0
  }
];
var index = 1;
var box = $( ".clipped" ).cssClip( clippings[ 0 ] );
 
$( document ).click(function() {
  box.animate( {
    clip: clippings[ index++ % 2 ]
  }, 2000 );
});
 
</script>
 
</body>
</html>演示:
相關用法
- JQuery .css()用法及代碼示例
- JQuery .contextmenu()用法及代碼示例
- JQuery .contents()用法及代碼示例
- JQuery .click()用法及代碼示例
- JQuery .context用法及代碼示例
- JQuery .clearQueue()用法及代碼示例
- JQuery .closest()用法及代碼示例
- JQuery .children()用法及代碼示例
- JQuery .change()用法及代碼示例
- JQuery .clone()用法及代碼示例
- JQuery .jquery用法及代碼示例
- JQuery .scroll()用法及代碼示例
- JQuery .add()用法及代碼示例
- JQuery .undelegate()用法及代碼示例
- JQuery .load()用法及代碼示例
- JQuery .empty()用法及代碼示例
- JQuery UI .labels()用法及代碼示例
- JQuery UI .addClass()用法及代碼示例
- JQuery UI .toggleClass()用法及代碼示例
- JQuery .removeAttr()用法及代碼示例
- JQuery .addClass()用法及代碼示例
- JQuery .next()用法及代碼示例
- JQuery UI .hide()用法及代碼示例
- JQuery .promise()用法及代碼示例
- JQuery .trigger()用法及代碼示例
注:本文由純淨天空篩選整理自jqueryui.com大神的英文原創作品 .cssClip()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
