2012-10-19 76 views
2

)試圖讓WordPress庫在wordpress中運行,但我不太確定要放入.ready(函數)以便運行原始頁面到jQuery的功能在這裏:http://manos.malihu.gr/simple-jquery-fullscreen-image-gallery/2什麼把jQuery(文檔).ready(函數()

我假設我需要運行一些函數來運行整個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'); 
+0

似乎腳本中有一些$(window).load(function()嵌入其中,所以我不確定是否需要添加任何東西 – coopersita

+0

您是使用完整的HTML/Javascript還是僅僅使用Javascript? – Ian

+0

我正在投票結束,這就像是問,_「我要在''裏面放什麼'?」_或_「我在CSS文件中放什麼?」_ – Sparky

回答

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」文件中設置。

+0

謝謝你的幫助傑森!當我在我的本地主機上查看源代碼時,它似乎正在加載腳本,但由於某些原因,更改不會在網站的前端生效。我試着將代碼從.js文件移動到functions.php中,就像你所建議的那樣,但似乎並沒有改變。我會繼續嘗試! – Andy

相關問題