首页 \ 问答 \ 暂停Nivo滑块(Pause Nivo Slider)

暂停Nivo滑块(Pause Nivo Slider)

我想暂停Nivo滑块5秒钟,然后显示第一幅图像。 所以我需要在afterLoad之后在属性中添加一些代码。

在运行滑块代码之前,我尝试过setTimout,但它并没有给出我想要的结果。

先谢谢了!

编辑:当前代码

$(window).load(function(){
 $('#slider').nivoSlider({
     animSpeed: 500,
     pauseTime: 4000,
     effect : 'boxRain',
     directionNav : false,
     controlNav: false,
     afterLoad: function(){
         //$('#slider').data('nivoslider').stop();      
     }
 });
});

I'd like to pause the Nivo slider for 5 seconds before it runs but show the first image. So I'll need to add some code in the property afterLoad I believe.

I've tried setTimout before running the slider code be it doesn't give the result I'd like.

Thanks in advanced!

Edit: Current Code

$(window).load(function(){
 $('#slider').nivoSlider({
     animSpeed: 500,
     pauseTime: 4000,
     effect : 'boxRain',
     directionNav : false,
     controlNav: false,
     afterLoad: function(){
         //$('#slider').data('nivoslider').stop();      
     }
 });
});

原文:https://stackoverflow.com/questions/8135625
更新时间:2021-10-13 06:10

最满意答案

我们称之为model3 ... model3 ;

@property (nonatomic, strong) NSMutableArray *mainArray;
@property (nonatomic, strong) NSMutableArray *leftArray;
@property (nonatomic, strong) NSMutableArray *rightArray;

@property (nonatomic, strong) UIScrollView *mainView;
@property (nonatomic, strong) UIScrollView *leftView;
@property (nonatomic, strong) UIScrollView *rightView;

你需要在ItemModel创建一个模型类,比如ItemModel继承UIViewNSObject ,制作一些属性(你需要什么属性以及UIScrollView包含这个模型的属性)

首先,将所有模型放在mainView的数据源mainArray ,在mainArray中显示模型并调用self.view bringSubviewToFront:并为所有模型提供UIPanGestureRecognizer和响应UIPanGestureRecognizer的方法,以便您可以拖动它们。

这是最重要的部分:

因为您希望所有模型都包含三个UIView ,所以必须计算self.view.frame和三个UIView帧关系之间的模型框架。 实际上,所有modelView都包含在self.view中,但是在可视化显示时,所有modelView都包含在UIScrollViews中。

其次,你已经有了三个UIView的框架,当你拖动模型时,你可以得到关于拖动位置的CGPoint ,然后调用方法CGRectContainsPoint(CGRect rect, CGPoint point) ,这样你就可以得到任何包含该点的视图你拖。

例如,您将mainViewmainView拖到leftView ,您可以从CGRectContainsPoint(leftview.frame, point)获得YES ,然后从mainArray删除mainArray并将mainArray放在leftArray ,同时您需要重新布局三个UIViews

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

这是我的gif共享网址: https//pan.baidu.com/s/1slFBva9


Let's call the items model1 ... model3;

@property (nonatomic, strong) NSMutableArray *mainArray;
@property (nonatomic, strong) NSMutableArray *leftArray;
@property (nonatomic, strong) NSMutableArray *rightArray;

@property (nonatomic, strong) UIScrollView *mainView;
@property (nonatomic, strong) UIScrollView *leftView;
@property (nonatomic, strong) UIScrollView *rightView;

You need make a model class such as ItemModel inherit UIView or NSObject, in ItemModel.h make some property(what property you need and a property about which UIScrollView contains this model)

First, put all models in the mainView's datasourcemainArray, display models in your self.view and call self.view bringSubviewToFront: and give all models a UIPanGestureRecognizer and a method to respond to UIPanGestureRecognizer so you can drag them.

This is the most important part:

Because you want all models to be contained by three UIViews, you must calculate the models frame between self.view.frame and the three UIView frames relationship. In fact, all modelViews is contained by self.view, but when visually displayed, all modelViews is contained within UIScrollViews.

Second, you already have the frame of three UIView, when you drag model, you can get CGPoint about the location of the drag, then call the method CGRectContainsPoint(CGRect rect, CGPoint point), so you can get any view that contains the point you drag.

For exexample, you drag model1 from mainView to leftView, you can get a YES from CGRectContainsPoint(leftview.frame, point), then remove the model1 from mainArray and put model1 in leftArray, meanwhile you need to re-layout the three UIViews.

enter image description here

enter image description here

enter image description here

here is my share URL for the gif:https://pan.baidu.com/s/1slFBva9

相关问答

更多
  • 如果其他人偶然发现这个问题,答案是否定的,我不应该制作自定义的UICollectionViewFlowLayout来处理滑出的手势。 使用UIScrollViews比实现自定义布局更自然。 它提供了与滚动视图在整个iOS中相同的滚动和动量。 我设法用嵌套的UIScrollViews以一种非常简单的方式解决了我遇到的问题。 我似乎收到的警告实际上只是将收集视图放在选项卡视图控制器上的第一个选项卡点并让单元占据整个屏幕的错误。 通过在集合视图后面添加额外的视图来解决此错误。 - (void)viewDidLoa ...
  • 看起来你在这里遇到了一个系统限制 - 系统按照它们在XML中声明的顺序绘制视图。 因此,当您抛出第一个声明的ScrollView ,第二个会更新,但第一个不会再次更新。 然而,当您放弃第二个时,第一个更新,然后第二个更新,更改将反映到第一个,并再次更新。 我不确定上面的描述是100%准确的,但它是这样的。 我创建了一个测试用例来检查我的假设,用以下代替main.xml :
  • 如何在小部件的边界外绘制? 当我试图将一个画布元素的一部分移动到小部件之外时,它只是切断了那个部分,这并不奇怪。 也许我可以在这个之外制作另一个小部件并借鉴它? 真的不知道你的意思。 canvas没有边界,除非你使用Stencil 。 当您尝试在ScrollView外部绘制时,窗口小部件空间内的内容将被隐藏,因为最初它使用Stencil以便隐藏不必要的内容,您可以滚动浏览它,如此处所示 。 现在关于那个重叠。 canvas.after在第二个Color之前使其在绘制小部件后绘制。 与canvas.befor ...
  • 将android:fillViewport="true"属性添加到您的滚动视图。 它会帮助你获得完美的布局。
    问题是我在两个scrollView上都启用了分页,并且它是冲突的。 我通过在外部scrollView上禁用分页并使用scrollDelegate实现它来解决它。 The problem was that I had paging enabled on both scrollViews and it was conflicting. I solved it by disabling paging on the outer scrollView and implement using the scrollDel ...
  • 是的,是的,这是可能的。 您需要将一个委托分配给单元格中的scrollViews。 最好是实现小时tableview数据源和表视图委托协议的同一个类。 您必须实现UIScrollViewDelegate ,并且委托必须实现scrollViewDidScroll:方法。 在该scrollViewDidScroll委托方法中,检查contentOffset属性的x和/或y值。 通常人们会选择垂直滚动值,但如果你在UITableViewCell中实现它们,你可能正在进行水平滚动。 您使用该值,我假设content ...
  • 这只是使用手势识别器的问题(参见事件处理程序指南 )。 实际实现取决于您想要的方式。 这是一个随机的例子,我有一个分割视图控件,我将左边的tableview拖动到右边的视图中,长按触发整个拖放(例如“点击并按住” )。 因此,我只是在tableview控制器的viewDidLoad中创建一个手势识别器(在我的例子中,是主视图控制器): UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWit ...
  • 我们称之为model3 ... model3 ; @property (nonatomic, strong) NSMutableArray *mainArray; @property (nonatomic, strong) NSMutableArray *leftArray; @property (nonatomic, strong) NSMutableArray *rightArray; @property (nonatomic, strong) UIScrollView *mainView; @pro ...
  • 抱歉!!! 但你的问题有点复杂。 我现在建议你最好的是每个滚动视图的USE标记,而不是将它们放在数组中 。 此致,Code Blizzard SORRY!!! But your question is the bit complex to understand. What I'll suggest you the best, for now, is that to USE tag for every scroll views rather than putting them in array. Regard ...
  • 您的HSV究竟在哪里? 它固定在屏幕的底部吗? 如果是这样,这就是我要做的。 在你的onFling活动中,检查fling的Y位置并确保它不在你的HSV中。 如果是,那么返回false,你应该好好去。 Where exactly is your HSV? Is it pinned to the bottom of the screen? If so, here's what I would do. Within your onFling event, check the Y position of the f ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。