Use jQuery.on() properly. Add some slideUp()/slideDown() transitions to ease post format switches. see #19570
git-svn-id: http://core.svn.wordpress.org/trunk@23853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a33987528b
commit
fb78aa819e
|
@ -4,7 +4,7 @@ $format_meta = get_post_format_meta( $post_ID );
|
|||
|
||||
?>
|
||||
<div class="post-format-description"></div>
|
||||
<div class="post-formats-fields edit-form-section">
|
||||
<div class="post-formats-fields">
|
||||
|
||||
<input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" />
|
||||
|
||||
|
|
|
@ -3,8 +3,10 @@ window.wp = window.wp || {};
|
|||
(function($) {
|
||||
var mediaFrame, lastMimeType, lastMenu, mediaPreview;
|
||||
$(function(){
|
||||
var $container = $( '.post-formats-fields' );
|
||||
|
||||
// Post formats selection
|
||||
$('.post-format-options a').on( 'click', function(e){
|
||||
$('.post-format-options').on( 'click', 'a', function(e){
|
||||
var $this = $(this), editor, body,
|
||||
parent = $this.parent(),
|
||||
format = $this.data('wp-format'),
|
||||
|
@ -16,8 +18,12 @@ window.wp = window.wp || {};
|
|||
$('#icon-edit').removeClass(postFormats.currentPostFormat).addClass(format);
|
||||
$('#post_format').val(format);
|
||||
|
||||
$container.slideUp( 200, function(){
|
||||
container.get(0).className = container.get(0).className.replace( /\bwp-format-[^ ]+/, '' );
|
||||
container.addClass('wp-format-' + format);
|
||||
$container.slideDown( 400 );
|
||||
});
|
||||
|
||||
$('#title').focus();
|
||||
|
||||
// Update description line
|
||||
|
@ -39,9 +45,9 @@ window.wp = window.wp || {};
|
|||
postFormats.currentPostFormat = format;
|
||||
|
||||
e.preventDefault();
|
||||
}).on('mouseenter focusin', function () {
|
||||
}).on('mouseenter focusin', 'a', function () {
|
||||
$('.post-format-tip').html( $(this).prop('title') );
|
||||
}).on('mouseleave focusout', function () {
|
||||
}).on('mouseleave focusout', 'a', function () {
|
||||
$('.post-format-tip').html( $('.post-format-options a.active').prop('title') );
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue