WordPress.org

Make WordPress Core

Changeset 23853


Ignore:
Timestamp:
03/29/2013 07:06:21 AM (9 years ago)
Author:
markjaquith
Message:

Use jQuery.on() properly. Add some slideUp()/slideDown() transitions to ease post format switches. see #19570

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post-formats.php

    r23843 r23853  
    55?>
    66<div class="post-format-description"></div>
    7 <div class="post-formats-fields edit-form-section">
     7<div class="post-formats-fields">
    88
    99    <input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" />
  • trunk/wp-admin/js/post-formats.js

    r23851 r23853  
    44    var mediaFrame, lastMimeType, lastMenu, mediaPreview;
    55    $(function(){
     6        var $container = $( '.post-formats-fields' );
     7
    68        // Post formats selection
    7         $('.post-format-options a').on( 'click', function(e){
     9        $('.post-format-options').on( 'click', 'a', function(e){
    810            var $this = $(this), editor, body,
    911                parent = $this.parent(),
     
    1719            $('#post_format').val(format);
    1820
    19             container.get(0).className = container.get(0).className.replace( /\bwp-format-[^ ]+/, '' );
    20             container.addClass('wp-format-' + format);
     21            $container.slideUp( 200, function(){
     22                container.get(0).className = container.get(0).className.replace( /\bwp-format-[^ ]+/, '' );
     23                container.addClass('wp-format-' + format);
     24                $container.slideDown( 400 );
     25            });
     26
    2127            $('#title').focus();
    2228
     
    4046
    4147            e.preventDefault();
    42         }).on('mouseenter focusin', function () {
     48        }).on('mouseenter focusin', 'a', function () {
    4349            $('.post-format-tip').html( $(this).prop('title') );
    44         }).on('mouseleave focusout', function () {
     50        }).on('mouseleave focusout', 'a', function () {
    4551            $('.post-format-tip').html( $('.post-format-options a.active').prop('title') );
    4652        });
Note: See TracChangeset for help on using the changeset viewer.