2

一直在尝试让 javascript 库在 wordpress 中运行,但我不太确定要在 .ready(function) 中放入什么才能运行库。jQuery函数的原始页面在这里: http: //manos.malihu.gr/simple-jquery-fullscreen-image-gallery/2

我假设我需要运行一些将运行整个 javascript 文件的函数,但我不太确定该函数可能是什么。很抱歉对此如此陌生,但非常感谢您的帮助!

function malihu_gallery() {
if (!is_admin()) {

    // Enqueue Malihu Gallery JavaScript
    wp_register_script('malihu-jquery-image-gallery', get_template_directory_uri(). '/js/malihu-jquery-image-gallery.js', array('jquery'), 1.0, true );
    wp_enqueue_script('malihu-jquery-image-gallery'); 

    // Enqueue Malihu Gallery Stylesheet
    wp_register_style( 'malihu-style', get_template_directory_uri() . '/CSS/malihu_gallery.css', 'all' );
    wp_enqueue_style('malihu-style' );

    function gallery_settings () { ?>
    <script type="text/javascript">
        jQuery(document).ready(function() {
            // What do I put in here?
        });
    </script><?php
    }
  }
}

add_action('init', 'malihu_gallery');
4

1 回答 1

0

我猜,基于实际代码的有限视图,这组变量应该在那个空间中设置/修改:

//config
//set default images view mode
$defaultViewMode="full"; //full, normal, original
$tsMargin=30; //first and last thumbnail margin (for better cursor interaction) 
$scrollEasing=600; //scroll easing amount (0 for no easing) 
$scrollEasingType="easeOutCirc"; //scroll easing type 
$thumbnailsContainerOpacity=0.8; //thumbnails area default opacity
$thumbnailsContainerMouseOutOpacity=0; //thumbnails area opacity on mouse out
$thumbnailsOpacity=0.6; //thumbnails default opacity
$nextPrevBtnsInitState="show"; //next/previous image buttons initial state ("hide" or "show")
$keyboardNavigation="on"; //enable/disable keyboard navigation ("on" or "off")

当然,这假设这些变量尚未在您的“/js/malihu-jquery-image-gallery.js”文件中设置。

于 2012-10-19T03:08:48.147 回答