2013-10-18 100 views
0

好了,我已經成功地通過鼠標滾輪來獲得水平滾動我我使用Expositio主題WordPress站點工作(http://wpshower.com/themes/expositio/如何防止加載jquery.mousewheel.js在網頁中的WordPress

它使用布蘭登亞倫的jQuery的鼠標滾輪,可以在這裏找到:https://github.com/brandonaaron/jquery-mousewheel/zipball/master/(對於那些你們誰很難找到一個工作環節和我一樣!)

這個代碼在我的header.php後:

 <?php 
     wp_enqueue_script('jquery'); 

     if (is_singular() && get_option('thread_comments')) wp_enqueue_script('comment-reply'); 
     wp_head(); 
    ?> 

我我插入了這個:

<script type="text/javascript" src="<?php bloginfo("template_url"); ?>/includes/jquery.mousewheel.js"></script> 

<script type="text/javascript"> 
jQuery(function($) { 
    $('html, body').mousewheel(function(event, delta) { 
     this.scrollLeft -= (delta * 90); 
     event.preventDefault(); 
    }) 
}); 
</script> 

其中一期工程完美&看起來偉大與這個主題(我希望以上這些信息對於像我這樣的一個又一個新手有用的 - 在「90後」表示速度 - 我發現默認的30太慢了滾動在我的網站上的內容)

不過,我想水平滾動到負載特定頁面,如「關於」等等。事實上,如果加載被阻止在這個插件它也許可以工作的所有頁(因爲這些沒有Expositio主題的其餘部分的水平佈局)

沒有人有任何想法是什麼代碼可能會奏效,使這一切成爲可能?我想帖子加載水平鼠標滾輪滾動,而不是(或至少能排除特定頁)。我非常感謝任何幫助 - 我厭倦了在黑暗中徘徊! :)

+0

關於您的下載困難,你應該下載當前的主分支,你不希望使用最前沿的開發版本,但一些[標籤版本(HTTPS的:// github上.com/brandonaaron/jquery-mousewheel/tags)或使用[jQuery插件註冊表](http://plugins.jquery.com/mousewheel/)。 – nietonfir

回答

1
<?php 
if(!is_page()) { ?> 

<script type="text/javascript" src="<?php bloginfo("template_url"); ?>/includes/jquery.mousewheel.js"></script> 

<?php } ?> 
+0

這個完美的作品!非常感激。 :) – Lull

+0

@Lull因爲你似乎是一個新用戶,你可能想[參觀](http://stackoverflow.com/about)或閱讀[這篇文章](http://meta.stackexchange.com/a/5235/224848)如何接受答案。 ;-) – nietonfir

+0

排序 - 謝謝@nietonfir :) – Lull