54. Click and Show
html anchor
onClick: (html jQuery: 'div.help') toggle;
with: 'About jQuery'.
html div
class: 'help';
style: 'display: none';
with: 'jQuery is a fast and ...'
55. Replace a Component
html div
id: (id := html nextId);
with: child.
html anchor
onClick: ((html jQuery id: id) load
html: [ :r |
child := OtherComponent new;
r render: child ]);
with: ‘Change Component’
56. Update Multiple Elements
html div id: #date.
html div id: #time.
html anchor
onClick: (html jQuery ajax script: [ :s |
s << (s jQuery: #date)
html: [ :r | r render: Date today ].
s << (s jQuery: #time)
html: [ :r | r render: Time now ] ]);
with: ‘Update’
57. Display a Lightbox
| id |
html div
id: (id := html nextId);
script: (html jQuery new dialog
title: 'Lightbox Dialog';
overlay: (Dictionary new
at: 'background-color' put: '#000';
at: 'opacity' put: 0.75;
yourself);
modal: true);
with: [ self renderDialogOn: html ]
html anchor
onClick: (html jQuery id: id) dialog open;
with: 'Open Lightbox'