jquery-ui/demos/functional/templates/ui.effects.general.html

140 lines
7.9 KiB
HTML
Raw Normal View History

2008-06-16 10:23:09 +00:00
<script type="text/javascript">
var model = {
renderAt: '#containerDemo',
title: 'General Effects',
demos: [
{
title: 'Bounce',
desc: 'Bounce an element from its original location. The default settings are {times: 5, direction: "up", distance: 20}.',
2008-08-24 23:32:11 +00:00
html: '<button id="doBounce" type="button">Bounce</button><br/><br/>\n' +
2008-06-16 10:23:09 +00:00
'<div style="height: 108px;"><img id="bounce" src="templates/images/P1010036.JPG"/></div>',
destroy: '$("#doBounce").unbind();',
options: [
{ desc: 'Bounce defaults', source: '$("#doBounce").click(function() { $("#bounce").effect("bounce", {}, 500); });' },
{ desc: 'Bounce three times', source: '$("#doBounce").click(function() { $("#bounce").effect("bounce", {times: 3}, 500); });' },
{ desc: 'Bounce once', source: '$("#doBounce").click(function() { $("#bounce").effect("bounce", {times: 1}, 500); });' },
{ desc: 'Bounce down', source: '$("#doBounce").click(function() { $("#bounce").effect("bounce", {direction: "down"}); });' },
{ desc: 'Bounce left', source: '$("#doBounce").click(function() { $("#bounce").effect("bounce", {direction: "left"}); });' },
{ desc: 'Bounce right', source: '$("#doBounce").click(function() { $("#bounce").effect("bounce", {direction: "right"}); });' },
{ desc: 'Bounce to height 50', source: '$("#doBounce").click(function() { $("#bounce").effect("bounce", {distance: 50}); });' },
{ desc: 'Bounce and show/hide', source: '$("#doBounce").click(function() { $("#bounce").toggle("bounce", {times: 3}, 500); });' }
]
},
{
title: 'Highlight',
desc: 'Highlight an element by fading its background color from another color back to its original.',
2008-08-24 23:32:11 +00:00
html: '<button id="doHighlight" type="button">Highlight</button><br/><br/>\n' +
2008-06-16 10:23:09 +00:00
'<div id="highlight" style="width: 144px; height: 108px; background-color: #ccffff; text-align: center;"><br/><br/>\n' +
'This is an important announcement!</div>',
destroy: '$("#doHighlight").unbind();',
options: [
2008-08-24 23:32:11 +00:00
{ desc: 'Highlight defaults (yellow)', source: '$("#doHighlight").click(function() { $("#highlight").effect("highlight", {}, 800); });' },
{ desc: 'Highlight to red', source: '$("#doHighlight").click(function() { $("#highlight").effect("highlight", {color: "red"}, 800); });' },
{ desc: 'Highlight to black', source: '$("#doHighlight").click(function() { $("#highlight").effect("highlight", {color: "#000000"}, 800); });' }
2008-06-16 10:23:09 +00:00
]
},
{
title: 'Pulsate',
desc: 'Pulsate an element by changing its opacity.',
2008-08-24 23:32:11 +00:00
html: '<button id="doPulsate" type="button">Pulsate</button><br/><br/>\n' +
2008-06-16 10:23:09 +00:00
'<div style="height: 108px;"><img id="pulsate" src="templates/images/P1010061.JPG"/></div>',
destroy: '$("#doPulsate").unbind();',
options: [
{ desc: 'Pulsate defaults (5 times)', source: '$("#doPulsate").click(function() { $("#pulsate").effect("pulsate", {}, 500); });' },
{ desc: 'Pulsate 3 times', source: '$("#doPulsate").click(function() { $("#pulsate").effect("pulsate", {times: 3}, 500); });' },
{ desc: 'Pulsate once', source: '$("#doPulsate").click(function() { $("#pulsate").effect("pulsate", {times: 1}, 1000); });' },
{ desc: 'Pulsate 3 times and show/hide', source: '$("#doPulsate").click(function() { $("#pulsate").toggle("pulsate", {times: 3}, 500); });' }
]
},
{
title: 'Scale',
2008-06-26 16:05:17 +00:00
desc: 'Scales an element up or down by a percentage factor.',
2008-08-24 23:32:11 +00:00
html: '<button id="doScale" type="button">Scale</button> \n' +
'<button onclick="$(\'#scale\').css({width: 144, height: 108});" type="button">Reset</button><br/><br/>\n' +
'<div style="height: 108px;" type="button"><img id="scale" src="templates/images/P1010063.JPG"/></div>',
2008-06-16 10:23:09 +00:00
destroy: '$("#doScale").unbind();',
options: [
2008-08-24 23:32:11 +00:00
{ desc: 'Scale to 0%', source: '$("#doScale").click(function() { $("#scale").effect("scale", {percent: 0}, 800); });' },
{ desc: 'Scale to 50%', source: '$("#doScale").click(function() { $("#scale").effect("scale", {percent: 50}, 800); });' },
{ desc: 'Scale to 200%', source: '$("#doScale").click(function() { $("#scale").effect("scale", {percent: 200}, 800); });' },
{ desc: 'Scale vertically only', source: '$("#doScale").click(function() { $("#scale").effect("scale", {direction: "vertical", percent: 150}, 800); });' },
{ desc: 'Scale horizontally only', source: '$("#doScale").click(function() { $("#scale").effect("scale", {direction: "horizontal", percent: 150}, 800); });' },
{ desc: 'Scale from middle-center', source: '$("#doScale").click(function() { $("#scale").effect("scale", {origin: ["middle", "center"], percent: 150}, 800); });' },
{ desc: 'Scale from bottom-right', source: '$("#doScale").click(function() { $("#scale").effect("scale", {origin: ["bottom", "right"], percent: 50}, 800); });' }
2008-06-16 10:23:09 +00:00
]
},
{
title: 'Size',
2008-06-26 16:05:17 +00:00
desc: 'Changes the size of an element by specifying a width and height.',
2008-08-24 23:32:11 +00:00
html: '<button id="doSize" type="button">Size</button> \n' +
'<button onclick="$(\'#size\').css({width: 144, height: 108});" type="button">Reset</button><br/><br/>\n' +
'<div style="height: 108px;" type="button"><img id="size" src="templates/images/P1010063.JPG"/></div>',
destroy: '$("#doSize").unbind();',
options: [
2008-08-24 23:32:11 +00:00
{ desc: 'Size to 75x200', source: '$("#doSize").click(function() { $("#size").effect("size", {to: {width:75, height:200}}, 800); });' },
{ desc: 'Size to 200x75', source: '$("#doSize").click(function() { $("#size").effect("size", {to: {width:200, height:75}}, 800); });' },
{ desc: 'Size (125x210) from middle-center', source: '$("#doSize").click(function() { $("#size").effect("size", {to: {width:125, height:210}, origin: ["middle", "center"]}, 800); });' },
{ desc: 'Size (210x125) from bottom-right', source: '$("#doSize").click(function() { $("#size").effect("size", {to: {width:210, height:125}, origin: ["bottom", "right"]}, 800); });' }
]
},
2008-06-16 10:23:09 +00:00
{
title: 'Shake',
desc: 'Shake an element around.',
2008-08-24 23:32:11 +00:00
html: '<button id="doShake" type="button">Shake</button><br/><br/>\n' +
2008-06-16 10:23:09 +00:00
'<div style="height: 108px;"><img id="shake" src="templates/images/P1010039.JPG"/></div>',
destroy: '$("#doShake").unbind();',
options: [
{ desc: 'Shake defaults', source: '$("#doShake").click(function() { $("#shake").effect("shake", {}, 300); });' },
{ desc: 'Shake 5 times', source: '$("#doShake").click(function() { $("#shake").effect("shake", {times: 5}, 250); });' },
{ desc: 'Shake right', source: '$("#doShake").click(function() { $("#shake").effect("shake", {direction: "right"}, 250); });' },
{ desc: 'Shake up', source: '$("#doShake").click(function() { $("#shake").effect("shake", {direction: "up"}, 250); });' },
{ desc: 'Shake down', source: '$("#doShake").click(function() { $("#shake").effect("shake", {direction: "down"}, 250); });' },
{ desc: 'Shake by 50px', source: '$("#doShake").click(function() { $("#shake").effect("shake", {distance: 50}, 250); });' }
]
},
{
title: 'Transfer',
desc: 'Transfer the outline of one element to another.',
2008-08-24 23:32:11 +00:00
html: '<button id="doTransfer" type="button">Transfer</button><br/><br/>\n' +
2008-06-16 10:23:09 +00:00
'<div style="height: 108px;"><img id="transfer" src="templates/images/P1010044.JPG"/></div>\n' +
'<div id="target" style="margin: 20px 0px 0px 36px; width: 72px; height: 54px; border: 1px solid black;"></div>\n' +
'<style type="text/css">\n' +
'.ui-effects-transfer { border: 1px solid maroon; }\n' +
'.transferring { background-color: red; opacity: 0.5; }\n' +
'</style>',
destroy: '$("#doTransfer").unbind(); $("#target").removeClass("transferred");',
options: [
2008-08-24 23:32:11 +00:00
{ desc: 'Transfer default', source: '$("#doTransfer").click(function() { $("#transfer").effect("transfer", {to: "#target"}, 800); });' },
{ desc: 'Transfer with extra class', source: '$("#doTransfer").click(function() { $("#transfer").effect("transfer", {to: "#target", className: "transferring"}, 800); });' }
2008-06-16 10:23:09 +00:00
]
}
]
};
$(function(){
uiRenderDemo(model);
});
</script>