2014-07-21 127 views
-2

我想在wordpress中實現視差效果,類似於marcfitt.com。當您向下滾動時,轉盤保持固定並且較低的內容在其上滾動。我怎樣才能達到類似的目的?Wordpress - 視差效果

回答

0

此博客添加視差到您的網站一步步指導:http://wevostudio.com/wordpress-parallax-implementation/

<?php 

    function add_theme_scripts() { 

     wp_enqueue_script('parallax', get_template_directory_uri() . '/js/jquery.parallax-1.1.3.js', array(), '1.1.3', true); 

        wp_enqueue_script('nicescroll', get_template_directory_uri() . '/js/jquery.nicescroll.min.js', array(), '3.5.1', true); 

    } 

    add_action('wp_enqueue_scripts', 'add_theme_scripts'); 

?> 

<?php 
    function custom_post_type() { 
     $labels = array( 
      'name'    => _x('Parallax', 'general name'), 
      'singular_name'  => _x('Page', 'singular name'), 
      'add_new'   => _x('Add New', 'parallax'), 
      'add_new_item'  => __('Add New Page'), 
      'edit_item'   => __('Edit Page'), 
      'new_item'   => __('New Page'), 
      'all_items'   => __('All Pages'), 
      'view_item'   => __('View Page'), 
      'search_items'  => __('Search Pages'), 
      'not_found'   => __('No pages found'), 
      'not_found_in_trash' => __('No pages found in the Trash'), 
      'parent_item_colon' => '', 
      'menu_name'   => 'Parallax' 
     ); 
     $args = array( 
      'labels'  => $labels, 
      'public'  => true, 
      'menu_position' => null, 
      'supports'  => array('title', 'editor', 'thumbnail', 'excerpt', 'comments', 'page-attributes'), 
      'has_archive' => true, 
     ); 
     register_post_type(__('parallax'), $args); 
    } 
    add_action('init', 'custom_post_type'); 
?>