English 中文(简体)
Pass JSON into
原标题:Pass JSON into jQuery plugin

我试图说明如何在环境中以下列格式传承 p金(我知道,在这样的环境中,期望使用者跳跃进并玩 play,但我却正在建设一个全球倡议,以便与它一道:

   $( #animationContainer ).plugin({
       path :[
            { path_on_x :[ // PATH_ON X IS AN ARRAY
                { 0 : 0px , 1 : 0px , 2 : 0px }, // object 1 starting X values (0,1,2)
                { 0 : 0px , 1 : 0px , 2 : 0px }, // object 2 starting X values (0,1,2)
                { 0 : 150px , 1 : 150px , 2 : 150px } // object 3 starting X values...
            ]},
            { path_off_x :[ // PATH_ON X IS AN ARRAY
                { 0 : 0px , 1 : 0px , 2 : 0px },
                { 0 : 0px , 1 : 0px , 2 : 0px },
                { 0 : 150px , 1 : 150px , 2 : 150px }
            ]},
            { path_on_y :[ // PATH_ON Y IS AN ARRAY
                { 0 : 0px , 1 : 0px , 2 : 0px },
                { 0 : 0px , 1 : 0px , 2 : 0px },
                { 0 : 0px , 1 : 50px , 2 : 200px }
            ]},
            { path_off_y :[ // PATH_ON Y IS AN ARRAY
                { 0 : 0px , 1 : 0px , 2 : 0px },
                { 0 : 0px , 1 : 0px , 2 : 0px },
                { 0 : 200px , 1 : 50px , 2 : 0px }
            ]}
        ]
     });

该法典目前正在金字节中制定,Im指所有静态数值。 “PATH”包含与沿着一条道路对物体进行估算有关的所有环境。 这条道路从0到1点到2点等,都有具体的协调价值。

阵列内每一组坐标含有对不同物体进行消化的具体数值。 (CODE ABOVE)

I m用于处理典型的违约情况=......编码,只是与用户选择合并,但我如何在本案中设定违约(或某种其他的挫折环境)? 我确信,标准违约=......代码是不会予以削减的,而仅仅使用上述代码代替缺省,就说明可能有20个物体被消化,而不是上面所示3个。

任何建议? 感谢!

最佳回答

我建议采用这样一种形式:

$( #animationContainer ).plugin({
  "path": [
    {
      "x": [[0, 0, 0], [0, 0, 0]],
      "y": [[0, 0, 0], [0, 0, 0]]
    },
    {
      "x": [[0, 0, 0], [0, 0, 0]],
      "y": [[0, 0, 0], [0, 0, 0]]
    },
    {
      "x": [[150, 150, 150], [150, 150, 150]],
      "y": [[0, 50, 200], [200, 50, 200]]
    }
  ]
});

这样,你就拥有属于某一物体的财产,而不是将其平均分配。 <>m>(BTW,“path”财产本身看起来是一个好候选人,可以融入单个物体,而不是保持顶层。

直接获取财产:

options.path[0].x[0] // starting values
options.path[0].x[1] // stopping values

对他们适用违约是容易的。 它的所有需求都是 lo。

for(var i=0; i<options.path.length; i++) {
  // merge options.path[i] with default values, e.g. via $.extend()
}
问题回答

你可以把json带入你的gin子,然后将json改为你的要求。 没有必要在金字面上使用这一json格式。 相反,如果条件容易的话,你可以 lo住和使用。 这样,就没有什么工具可以帮助你。





相关问题
jQuery - ScrollTo and Serial Scroll not working together

I have tested the scrollTo() plugin, but I need a way to stop the scrolling animation, so I am looking at serialScroll(). Here is what I used with scrollTo: $( #scroller ).scrollTo( 1000px , 3000); ...

jQuery deconstructors for plugins?

I m using the Galleria plugin inside an Accordion plugin to display images in a super cool way. A problem occurs, however, when I open up a new tab (in the accordion) then come back to the gallery tab....

XPCOM Security issues

I m developing a Firefox plugin using XPCOM, I ve not yet read all the docs, but as far as I can see, A plugin is simply a DLL that provides services via a XPCOM interface and interacts with the ...

Ruby on Rails plugin development process

I m considering developing aspects of a website as Rails plugins for reuse. My question is about the development process. Since each of these plugins will provide a "slice" of functionality, should ...

help mongrel wont start

I have decided to switch from Restful authentication to authlogic.. so what I did was delete every file and folder that got installed when I downloaded the plugin.. now when I try to "ruby script/...

Basic MEF workflow/usage

I m looking to a framework which will allow me to have a simple plugin system in my .NET application. It seems MEF is the framework which Microsoft is endorsing, and will become part of .NET 4 (it ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

java plugin cache and dynamic IP host

I m trying to use Amazon S3 and Amazon Cloudfront CDN to deliver the jar files of my applet application. I m seeing several cache misses of my jars by the java plugin. This is a show-stopper for me, ...

热门标签