English 中文(简体)
j功能参数动态变量
原标题:Dynamic variable in jQuery function parameters

Let me explain, I m using the code bellow to initiate a slideshow:

target.cycle({
            timeout: 0,
            before: onBefore,
            after: onAfter,
            next: target +  , #slide-next ,
            prev:  #slide-prev 
        })

My only problem is I m having trouble defining the next parameter which is supposed to take the selector of the slideshow itself; the variable target and the id of #slide-next

不幸的是,这一法典没有发挥作用,

when I use next: #slide-next , the slides transition when I press the next button, when I use, next: target, the slides transition when I click on the slides themselves but when I use next: target + ,#slide-next , they transition only when I click on the slideshow and not on the next button.

我如何界定<代码>next?

Thank you!

问题回答
var next = target.add("#slide-next");    

target.cycle({
        timeout: 0,
        before: onBefore,
        after: onAfter,
        next: next,
        prev:  #slide-prev 
})

我不敢肯定你想要做些什么,但这里有一些可能帮助你。

在要素中,有些属性代表了下一个要素的一位选择者,应当加以证明,例如:

 <div id="s1" data-next="#s2">...</div>

在您的初始化中,有一些考虑到目前要素并使用数据摘要作为以下特征的代码:

target.cycle({
        timeout: 0,
        before: onBefore,
        after: onAfter,
        next: $(target).attr("data-next"),
        prev:  #slide-prev 
    })

也许你需要修改这一法典,但我希望你看到想法。

Jovan





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签