通过onClick在另一个元素上暂停supersized.js [英] Pausing supersized.js through onClick on another element

查看:59
本文介绍了通过onClick在另一个元素上暂停supersized.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我无法理解jQuery,但是有一个适合我当前项目规范的库,所以我不得不忍痛忍受.
这就是麻烦所在-我在页面上显示超大幻灯片,并在底部的导航栏中添加了几个按钮.这些按钮可打开灯箱"样式弹出窗口,提供有关当前图像的更多信息.一切正常,整个世界都很好,但是幻灯片一直在滚动,我需要停下来.

我已经参考了API文档,并且有一个可以切换播放/暂停功能的函数:

Hi Guys,

I can''t get my head around jQuery, but there''s a library for it that fits my current project specs, so I''ve had to bite the bullet.
Here''s the rub - I''m displaying the supersized slideshow on my page, and I''ve added a couple of buttons to the navigation bar at the bottom. These buttons open ''Lightbox'' style pop ups providing more information on the current image. Everything works and all is good with the world, but the slideshow keeps on rolling along, and I need it to stop.

I''ve referred to the API docs, and there''s a function that toggles the play / pause functionality:

$(element).click(function(){
	api.playToggle();
});


我知道这段代码将点击处理程序添加到了元素"中,但是我如何从非jQuery对象中调用此函数以响应点击呢?我经常使用javascript,而不仅仅是jQuery.我的经验归结为更改DOM对象属性客户端,我想用以下方式调用此函数:


I get that this code adds a click handler to ''element'', but how do I call this function myself from a non jQuery object in response to a click? I use javascript a lot, just not jQuery. My experience boils down to altering DOM object attribution client side, and I want to call this function in something like:

<div id="anotherElement"  önClick="api.playtoggle();">...


但是由于我缺乏jQuery知识,所以我不知道实际的调用(上面的那个显然不起作用...).我猜那里的某个地方有一美元,可能是元素的名称,也许是一两个括号?
我尝试了各种组合,但都没有奏效-因此,任何建议都非常感谢...

Danny


but because of my lack of jQuery knowledge, I have no idea of the actual call (the one above obviously doesn''t work...). I''m guessing there''s a dollar in there somewhere, and probably the name of the element, and maybe a bracket or two?
I''ve tried all sorts of combinations and none have worked - so any suggestions greatly appreciated...

Danny

推荐答案

(element).click( function (){ api.playToggle(); });
(element).click(function(){ api.playToggle(); });


我知道这段代码将点击处理程序添加到了元素"中,但是我如何从非jQuery对象中调用此函数以响应点击呢?我经常使用javascript,而不仅仅是jQuery.我的经验归结为更改DOM对象属性客户端,我想用以下方式调用此函数:


I get that this code adds a click handler to ''element'', but how do I call this function myself from a non jQuery object in response to a click? I use javascript a lot, just not jQuery. My experience boils down to altering DOM object attribution client side, and I want to call this function in something like:

<div id="anotherElement"  önClick="api.playtoggle();">...


但是由于我缺乏jQuery知识,所以我不知道实际的调用(上面的那个显然不起作用...).我猜那里的某个地方有一美元,可能是元素的名称,也许是一两个括号?
我尝试了各种组合,但都没有奏效-因此,任何建议都非常感谢...

丹尼


but because of my lack of jQuery knowledge, I have no idea of the actual call (the one above obviously doesn''t work...). I''m guessing there''s a dollar in there somewhere, and probably the name of the element, and maybe a bracket or two?
I''ve tried all sorts of combinations and none have worked - so any suggestions greatly appreciated...

Danny


这篇关于通过onClick在另一个元素上暂停supersized.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆