欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

給WordPress的編輯后臺添加提示框的代碼實(shí)例分享

 更新時(shí)間:2015年12月25日 14:59:15   作者:斌果  
這篇文章主要介紹了給WordPress的編輯后臺添加提示框的代碼實(shí)例分享,即制作一個(gè)鼠標(biāo)指向后顯示詳細(xì)信息的效果,需要的朋友可以參考下

WordPress 3.5 新添加了一個(gè)提示框功能,可以創(chuàng)建一個(gè)提示框,然后指向任何元素,比如下邊的例子:

本文就來教你怎么創(chuàng)建一個(gè)這樣的提示框。

首先需要添加提示框20151225145502025.png (579×337)的腳本,這樣才能使用提示框的 JS 方法。

//掛載提示框腳本
function Bing_admin_pointer_enqueue_scripts(){
  wp_enqueue_style( 'wp-pointer' );
  wp_enqueue_script( 'wp-pointer' );
}
add_action( 'admin_enqueue_scripts', 'Bing_admin_pointer_enqueue_scripts' );

然后使用 pointer() 方法創(chuàng)建一個(gè)簡單的提示框:

/**
  *WordPress 后臺添加提示框
  *http://www.endskin.com/admin-help-box/
*/
function Bing_add_pointer_scripts(){
  $content = '<h3>請?jiān)O(shè)置主題</h3>';
  $content .= '<p>請為新主題進(jìn)行簡單的配置!';
?>  
  <script type="text/javascript">
  //<![CDATA[
  jQuery(document).ready(function($){
    $('#menu-appearance').pointer({//可以指向任何元素
      content: '<?php echo $content; ?>',
      position: {
        edge: 'left',
        align: 'center'
      },
      close: function(){
        //提示框打開之后做的事情
      }
    }).pointer('open');
  });
  //]]>
  </script>
<?php
}
add_action( 'admin_print_footer_scripts', 'Bing_add_pointer_scripts' );

綜合代碼:

/**
  *WordPress 后臺添加提示框
  *http://www.endskin.com/admin-help-box/
*/
function Bing_add_pointer_scripts(){
  $content = '<h3>請?jiān)O(shè)置主題</h3>';
  $content .= '<p>請為新主題進(jìn)行簡單的配置!';
?>  
  <script type="text/javascript">
  //<![CDATA[
  jQuery(document).ready(function($){
    $('#menu-appearance').pointer({//可以指向任何元素
      content: '<?php echo $content; ?>',
      position: {
        edge: 'left',
        align: 'center'
      },
      close: function(){
        //提示框打開之后做的事情
      }
    }).pointer('open');
  });
  //]]>
  </script>
<?php
}
add_action( 'admin_print_footer_scripts', 'Bing_add_pointer_scripts' );
 
//掛載提示框腳本
function Bing_admin_pointer_enqueue_scripts(){
  wp_enqueue_style( 'wp-pointer' );
  wp_enqueue_script( 'wp-pointer' );
}
add_action( 'admin_enqueue_scripts', 'Bing_admin_pointer_enqueue_scripts' );


相關(guān)文章

最新評論