Linux 软件免费装
Banner图

Vertical Center

开发者 Braad
更新时间 2015年12月7日 22:46
捐献地址: 去捐款
PHP版本: 3.8 及以上
WordPress版本: 4.4
版权: GPLv2 or later
版权网址: 版权信息

标签

responsive jQuery JavaScript vertical center

下载

1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1

详情介绍:

Vertical Center lets you easily vertically center elements. Features Check out the Screenshots tab for a gif of the plugin in action. Instructions
  1. Navigate to Settings > Vertical Center in the WordPress admin.
  2. Enter a selector and an offset for the element(s) you want to center.
  3. Add/remove additional elements by clicking the "+ Add More" and "Remove" buttons.
Advanced Want to trigger the vertical centering manually? No problem. You can skip entering a selector on the settings page and call the jQuery script yourself using either .initVerticalCenter() or .doVerticalCenter(). The .initVerticalCenter() method sets up the event listeners to recalculate if the window is resized, while the .doVerticalCenter() method directly centers without attaching any events: ` // Attach events and center. jQuery( '.selector' ).initVerticalCenter(); // Center without attaching events. jQuery( '.selector' ).doVerticalCenter(); ` Both functions take one optional argument, the offset value (as a number of pixels): ` jQuery( '.selector' ).initVerticalCenter( offset ); jQuery( '.selector' ).doVerticalCenter( offset ); ` To offset the calculation by 20 pixels: jQuery( '.selector' ).initVerticalCenter( 20 ); The functions are chainable. My personal favorite way to use this plugin is to inline style="opacity: 0;" on the elements that I am centering (to guarantee they'll be transparent when the DOM loads) and then fade them in with something like this: jQuery( '.selector' ).initVerticalCenter().delay( 200 ).fadeTo( 'slow', 1 ); Or to achieve the same effect with only CSS you can use the vc-complete class that gets added to each target element after the initial centering (added in version 1.0.3), which might look like this: target { opacity: 0; transition: opacity 0.5s; } target.vc-complete { opacity: 1; } This plugin also adds an event 'verticalcenter' to the window, allowing you to easily trigger the vertical centering manually. This is useful if you have added items to the page after it loads via AJAX. You can trigger the event like this: jQuery( window ).trigger( 'verticalcenter' );

安装:

Manual Installation
  1. Upload the entire /vertical-center directory to the /wp-content/plugins/ directory.
  2. Activate Vertical Center through the 'Plugins' menu in WordPress.
Better Installation
  1. Go to Plugins > Add New in your WordPress admin and search for Vertical Center.
  2. Click Install.

屏幕截图:

  • The easy-to-use admin interface.
  • Vertical centering in action.

升级注意事项:

1.1.1
  • Fix JS error when no option has yet been saved
1.1.0
  • Code cleanup and refactoring
  • The plugin class now loads on 'init'
  • All strings are now translatable
  • Added direct JS method .doVerticalCenter()
  • Bugfix: Pass correct plugin version when enqueueing the admin css
1.0.3
  • A class is now added to each target element after it has been initially centered
1.0.2
  • Improve centering calculation when parent elements have padding
1.0.1
  • Added support for using selectors that match multiple items
  • Improved compatibility with other plugins that use JS to affect layout
  • Bugfix: Better scoping of the admin JS to prevent conflicts with other plugins
1.0.0
  • First Release

更新日志:

1.1.1 1.1.0 1.0.3 1.0.2 1.0.1 1.0.0