小编din*_*ndu的帖子

jQuery - noConflict()问题

我有一个问题可能与我试图这样做的范围.

滑块可以工作.或者图像将替换文本.但不是两个.

我必须链接这个"scrollbox.min.js"文件才能使滑块工作.因此我使用noConflict.

我希望下面的代码片段使用scrollbox.min.js文件:

<script>
  jQuery().noConflict();
  jQuery(function($) {
        $(document).ready(function() {
          jQuery('#scrool').scrollbox({
            direction: 'h',
            switchItems: 3,
            distance: 540,
            autoPlay: false
          });
          jQuery('#scrool-backward').click(function() {
            jQuery('#scrool').trigger('backward');
          });
          jQuery('#scrool-forward').click(function() {
            jQuery('#scrool').trigger('forward');
          });
        })
      }
</script>
Run Code Online (Sandbox Code Playgroud)

我希望其余的人使用该网站的jQuery.

我注意到的东西:

取决于我放置jQuery()的位置.noConflict(); 它允许执行不同的代码段.我需要两个工作:

在此输入图像描述

在此输入图像描述

请参阅下面的脚本的完整部分:

<script src="http://www.qwerty.com/assets/xjs/jquery.scrollbox.min.js"></script>
<script>
  jQuery().noConflict();
  jQuery(function($) {
    $(document).ready(function() {
      jQuery('#scrool').scrollbox({
        direction: 'h',
        switchItems: 3,
        distance: 540,
        autoPlay: false
      });
      jQuery('#scrool-backward').click(function() {
        jQuery('#scrool').trigger('backward');
      });
      jQuery('#scrool-forward').click(function() {
        jQuery('#scrool').trigger('forward');
      });
    });
  });

</script>

<script>
  jQuery(function($) {
    $(document).ready(function() {

      jQuery('.starIMGrating').each(function(i, obj) {

        var myString = jQuery(this).html()

        if (myString > …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

12
推荐指数
2
解决办法
4510
查看次数

如何从对象数组中删除键

我有像下面这样的数组对象,如何将此格式转换为对象数组并删除键。

{
  "9417702107": {
    "name": "Sunny",
    "phone": "9417702107",
    "exists": true
  },
  "8826565107": {
    "name": "Gurwinder",
    "phone": "8826565107",
    "exists": true
  }
}
Run Code Online (Sandbox Code Playgroud)

如何使用javascript将其转换为以下格式:

[{
  "name": "Sunny",
  "phone": "9417702107",
  "exists": true
}, {
  "name": "Gurwinder",
  "phone": "8826565107",
  "exists": true
}]
Run Code Online (Sandbox Code Playgroud)

javascript arrays json

4
推荐指数
1
解决办法
8284
查看次数

如何在javascript中合并具有相同键的对象?

我有一个名为as的数组 commondata

commondata = [{
   giverUser: 'Abc',
   createdAt: '2016 11: 48: 40',
   note: 'Test'
 }, {
   giverUser: 'Xyz',
   createdAt: '12: 22: 37',
   note: 'Test data'
 }, {
   giverUser: 'Abc',
   createdAt: '2016 14: 22: 07',
   note: '"test123"'
 }];
Run Code Online (Sandbox Code Playgroud)

当我尝试将上面的对象数组与下面的代码合并时,我得到的数组与它相同.

以下是我的代码:

commondata.forEach(function(a, i) {

  if (!this[a.giverUser]) {

    this[a.giveruser] = {
      giverUser: a.giverUser,
      createdAt: [],
      note: []
    };
    r_grouped.push(this[a.giveruser]);
  }

  this[a.giveruser].createdAt = this[a.giveruser].createdAt.concat(a.createdAt);
  this[a.giveruser].note = this[a.giveruser].note.concat(a.note);
}, Object.create(null));
Run Code Online (Sandbox Code Playgroud)

上面的代码有什么问题?为什么我没有得到与同一个giveruser的合并数组?

javascript arrays foreach merge object

3
推荐指数
1
解决办法
1765
查看次数

为什么 sizeof(long long) 返回 8?

我是 C 的新手。sizeof(long)返回 8,因为 的大小long是 8 个字节(32 位操作系统为 4 个字节)。

但我想知道为什么sizeof(long long)也是8。不应该是16吗?

#include <stdio.h>
#include <stdint.h>

int main() {
  printf("%zu\n", sizeof(unsigned long));
  printf("%zu\n", sizeof(unsigned long long));

  return 0;
}
Run Code Online (Sandbox Code Playgroud)

c sizeof

3
推荐指数
1
解决办法
108
查看次数

How to pass string address to leaflet routing machine to get direction based on string address?

Well, I am using leaflet api and then I found a very nice supporting plugin called leaflet routing machine for showing address from A to B with nice route.

However, leaflet routing machine working fine with passing of latlng but not working with passing address so can anyone tell how it can work as I know property information on following link: So routing waypoint have property called name but don;t know how to use it to provide address a and …

javascript leaflet

2
推荐指数
1
解决办法
3273
查看次数

标签 统计

javascript ×4

arrays ×2

c ×1

foreach ×1

jquery ×1

json ×1

leaflet ×1

merge ×1

object ×1

sizeof ×1