package gwtquery.samples.client;\r
\r
+import static com.google.gwt.query.client.Effects.Effects;\r
+import static com.google.gwt.query.client.GQuery.$;\r
+\r
import com.google.gwt.core.client.EntryPoint;\r
import com.google.gwt.core.client.GWT;\r
import com.google.gwt.dom.client.Document;\r
import com.google.gwt.dom.client.NodeList;\r
import com.google.gwt.query.client.Function;\r
import com.google.gwt.query.client.GQuery;\r
-import static com.google.gwt.query.client.GQuery.$;\r
import com.google.gwt.query.client.Selector;\r
import com.google.gwt.query.client.Selectors;\r
import com.google.gwt.user.client.Event;\r
// two state variables to note current slide being shown\r
// and current bullet\r
int curSlide = 0;\r
-\r
int curBullets = 0;\r
\r
// query and store all slides, and bullets of current slide\r
GQuery slides = $(s.allSlides());\r
-\r
GQuery bullets = $(s.slideBulletsCtx(slides.get(curSlide)));\r
-\r
public boolean f(Event e) {\r
// onclick, if not all bullets shown, show a bullet and increment\r
if (curBullets < bullets.size()) {\r
- bullets.eq(curBullets++).show();\r
+ bullets.eq(curBullets++).fadeIn();\r
} else {\r
// all bullets shown, hide them and current slide\r
-// bullets.css("opacity","0");\r
bullets.hide();\r
- slides.eq(curSlide).hide();\r
-\r
-// slides.eq(curSlide).css("display", "none");\r
+ slides.eq(curSlide).as(Effects).hide();\r
// move to next slide, checking for wrap around\r
curSlide++;\r
if (curSlide == slides.size()) {\r
}\r
curBullets = 0;\r
// query for new set of bullets, and show next slide\r
- // by changing opacity to 1 and display to block\r
bullets = $(s.slideBulletsCtx(slides.get(curSlide)));\r
slides.eq(curSlide).show();\r
}\r
package gwtquery.samples.client;\r
\r
+import static com.google.gwt.query.client.GQuery.lazy;\r
+\r
import com.google.gwt.core.client.EntryPoint;\r
import com.google.gwt.core.client.GWT;\r
import com.google.gwt.query.client.GQuery;\r
import com.google.gwt.query.client.Selector;\r
import com.google.gwt.query.client.Selectors;\r
\r
-\r
public class GwtQuerySampleModule implements EntryPoint {\r
\r
public interface Sample extends Selectors {\r
-\r
@Selector(".note")\r
GQuery allNotes();\r
-\r
}\r
\r
public void onModuleLoad() {\r
Sample s = GWT.create(Sample.class);\r
- s.allNotes().text("Hello Google I/O");\r
+ s.allNotes().text("Hello Google I/O").\r
+ css("cursor", "pointer").\r
+ toggle(\r
+ lazy().css("color", "red").done(),\r
+ lazy().css("color", "").done()\r
+ );\r
}\r
}\r
border: 1px solid black;\r
width: 800px;\r
height: 600px;\r
- display: none\r
}\r
-\r
.slide {\r
- background: -webkit-gradient(linear, left top, left bottom, from(#000000), to(#808080), color-stop(0.9, #808080));\r
- -webkit-background-origin: padding-box;\r
- -webkit-background-clip: content-box;\r
+ background-color: #505050;\r
}\r
-\r
.slide, .slide * {\r
- color: white;\r
+ color: #ffffff;\r
font-size: 150%;\r
}\r
</style>\r