Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » a simple implementation of swipe slider
a simple implementation of swipe slider [message #1739138] Wed, 27 July 2016 16:27
zone whua is currently offline zone whuaFriend
Messages: 7
Registered: July 2009
Location: Wuhan China
Junior Member
A swipe slider is a frequently-used control in mobile application.
here is some tips. Laughing

Frist part, we need to create a customized widget.
Step1. Select a JS slider lib. e.g. flexslider
Step2. write handler.js
after that, we get a slider, support html sliding, but we need add composite in slider.

Second part, add control to slider.
Step1. name every slide.
	public void addControl(Control control, String thumbUrl) {
		if (items == null) {
			items = new ArrayList<Map<String, String>>();
		}
		UIToolkit.setAttribute(control, "name", "slider"+items.size());
               //rap.getObject( '", id, "' ).", $el, ".attr( '", attr, "', '", value + "' );
		Map<String, String> map = new HashMap<String, String>();
		map.put("name", "slider");
		map.put("thumb", thumbUrl);
		items.add(map);
	}

Step2.modify handler.js, find control, move it into slide and fix css
		onRender : function() {
			rap.off("render", this.onRender);
			var i;
			for (i in this.setting.items) {
				var item = document.createElement("li");
				item.setAttribute("data-thumb", this.setting.items[i].thumb);
					var slider = $("[name='slider" + i + "']");
					slider.css({
						"position" : "relative",
						"width" : "100%"
					});
					slider.attr({"name":"appended"});
					slider.appendTo(item);
				this.ul.appendChild(item);
			}


[Updated on: Wed, 27 July 2016 16:43]

Report message to a moderator

Previous Topic:RAP platform build fails on fresh clone of 3.1-maintenance
Next Topic:Get client location from browser
Goto Forum:
  


Current Time: Tue Oct 16 05:29:14 GMT 2018

Powered by FUDForum. Page generated in 0.01931 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top