简体   繁体   English

尝试将Smooth Div Scroll Jquery连接到我的网站,但未连接?

[英]Trying to connect Smooth Div Scroll Jquery to my site but its not connecting?

Hi I am trying to connect Smooth Div Scroll to my site: http://Izzy.me 嗨,我正在尝试将Smooth Div Scroll连接到我的网站: http : //Izzy.me

Smooth Div Scroll is this: http://smoothdivscroll.com/ Smooth Div Scroll是这样的: http : //smoothdivscroll.com/

In the front page of Izzy.Me I have 3 pictures of birds that I am using as an example to see if Smooth Div Scroll is connected. 在Izzy.Me的首页中,我以3张鸟的图片为例来查看是否连接了Smooth Div Scroll。

This is the CSS of those pictures: 这是这些图片的CSS:

    <div id="makeMeScrollable">
    <img src="http://www.birds.com/wp-content/uploads/home/bird4.jpg" alt="Field" id="field" />
    <img src="http://www.birds.com/wp-content/uploads/home/bird.jpg" alt="Gnome" id="gnome" />
    <img src="http://3.bp.blogspot.com/-KFaKPd9ytxM/TxdKjRZulaI/AAAAAAAAD6A/w0kduvREq2w/s1600/bird-1-wallpaper-1024x768-853745.jpeg" alt="Pencils" id="pencils" />
    </div>

In my child functions php I have this : 在我的子函数php中,我有这个:

    <?php

    function theme_javascript()
    {
    wp_enqueue_script( 'kinetic', get_template_directory_uri() .      '/js/jquery.kinetic.min.js', array('jquery'), '20140109', true );   
    wp_enqueue_script( 'mousewheel', get_template_directory_uri() . '/js/jquery.mousewheel.min.js', array('jquery'), '20140109', true );  
    wp_enqueue_script( 'smoothdivscroll', get_template_directory_uri() . '/js/jquery.smoothdivscroll-1.3-min.js', array('jquery'), '20140109', true ); 
    wp_enqueue_script( 'jquery-ui-1.8.23.custom', get_template_directory_uri() . '/js/jquery-ui-1.8.23.custom.min.js', array('jquery'), '20140109', true ); 
    wp_enqueue_script( 'jquery-ui-1.10.3.custom', get_template_directory_uri() . '/js/jquery-ui-1.10.3.custom.min.js', array('jquery'), '20140109', true ); 
    }

    add_action( 'wp_enqueue_scripts', 'theme_javascript' );


    ?> 

The file of the plugin that I downloaded from smoothscroll , includes both .min files and the full js files. 我从smoothscroll下载的插件文件包括.min文件和完整的js文件。 I just dragged and dropped the .min files into my parent themes JS folder and ignored the more complete .js files in the folder. 我只是将.min文件拖放到了父主题JS文件夹中,却忽略了该文件夹中更完整的.js文件。

I am not sure if my functions code is written right , because the name of the .min files confused me a little as to how to include them correctly. 我不确定我的函数代码编写是否正确,因为.min文件的名称使我对如何正确包含它们有些困惑。 So maybe thats why its not connecting ? 那么,也许这就是为什么它没有连接? the five names of the .min files are : .min文件的五个名称是:

  1. jquery.kinetic.min jquery.kinetic.min
  2. jquery.mousewheel.min jquery.mousewheel.min
  3. jquery.smoothdivscroll-1.3-min jquery.smoothdivscroll-1.3分钟
  4. jquery-ui-1.8.23.custom.min jquery-ui-1.8.23.custom.min
  5. jquery-ui-1.10.3.custom.min jquery-ui-1.10.3.custom.min

so looking back now at the functions php i included does it look right ? 所以现在回头看一下我包含的功能php,看起来正确吗? ( thanks for your help ) ( 谢谢你的帮助 )

debug your javascript: 调试您的JavaScript:

  1. open site in Chrome 在Chrome中打开网站
  2. press F12 按F12
  3. refresh the page, do you see any errors? 刷新页面,您看到任何错误吗?

在此处输入图片说明 Uncaught TypeError: Object function (e,t){return new x.fn.init(e,t,r)} has no method 'widget' - this error occurs if jQuery.UI is not connected 未捕获的TypeError:对象函数(e,t){返回新的x.fn.init(e,t,r)}没有方法'widget'-如果未连接jQuery.UI,则会发生此错误

try to find incompatible libraries: 尝试查找不兼容的库:

  1. create external working sample, then insert it into site ( http://jsfiddle.net/wnCPL/ ). 创建外部工作示例,然后将其插入网站( http://jsfiddle.net/wnCPL/ )。
  2. try to change order of js libraries. 尝试更改js库的顺序。
  3. try to exclude JS libraries sequentially one after the other 尝试一个接一个地依次排除JS库
  4. replace incompatible library to another similar or different version 将不兼容的库替换为另一个相似或不同的版本

sample html: 范例html:

<div id="makeMeScrollable">
    <img src="https://lh5.googleusercontent.com/-B5j3nmGIRLY/Uh3PDcFW1GI/AAAAAAAADmg/6qMAB1d7E4Y/w439-h612-no/DSC_1841-Edit_HDR-v2-w900-RP.jpg" alt="Field" id="field" />
    <img src="https://lh3.googleusercontent.com/-5JUmqJ5zOho/Uf5xP9l5LcI/AAAAAAABB-U/dVkkiLJ3_PA/w857-h612-no/In+Living+Color+%25C2%25A9+Laurie+Rubin_LAR3452.jpg" alt="Gnome" id="gnome" />
    <img src="https://lh5.googleusercontent.com/-NNtAD1d_Ekg/UgGad3929uI/AAAAAAAAXxc/oRerem5pkPg/w918-h612-no/Afternoon-2.jpg" alt="Pencils" id="pencils" />
</div>

sample javascript 示例javascript

$(document).ready(function () {
    $("#makeMeScrollable").smoothDivScroll({
        touchScrolling: true,
        manualContinuousScrolling: true,
        hotSpotScrolling: false,
        mousewheelScrolling: false
    });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM