Execute
Save
Share
Share link
share
share
share
Team
Public Teams
Comments
0
Created By:
Guest
Title:
Title
Description
Edit
Copy Link
Login
Email *
Password *
Login
OR
Create Account
Screen Name *
Email *
Password *
Retype Password *
Team Access Code
Register
Public CodeBins
HELP
--Select Theme--
Ambiance
Blackboard
Cobalt
Eclipse
Elegant
Erlang-Dark
Lesser-Dark
Monokai
Neat
Night
Rubyblue
Vibrant-Ink
Xq-Dark
New CodeBin
CodeBins Versions
01/28/2013- V.3
01/28/2013- V.2
01/28/2013- V.1
Compare Versions
Recent CodeBins
View All CodeBins
define('tda.module.Slider', ['dojo/_base/declare', 'dojo/_base/lang', 'dojo/query', 'dojo/_base/fx', 'dojo/fx/easing', 'dojo/dom-construct', 'dijit/_WidgetBase'], function(declare, lang, query, fx, easing, domConstruct, WidgetBase) { // using dijit/_WidgetBase to get lifecycle methods for now // replace dijit/_WidgetBase with tda/layout/Module after integration var Slider = declare([WidgetBase], { defaultParams: { duration: 500 }, constructor: function(options) { this.params = lang.mixin({}, this.defaultParams, options); }, startup: function() { domConstruct.place('<div class="move left">◀</div>', query('.viewport')[0], 'before'); domConstruct.place('<div class="move right">▶</div>', query('.viewport')[0], 'after'); this.bindMoveButtons(); }, bindMoveButtons: function() { var that = this; query('.move').on('click', function(e) { var left = /left/.test(e.target.className); var currentPos = parseInt((that.params.node.style.left || 0), 10); var offset = 106 * (left ? 1 : -1) * that.params.slideCount; var newPos = currentPos + offset; fx.animateProperty({ node: that.params.node, duration: that.params.duration, easing: easing.quintOut, properties: { left: newPos } }).play(); }); } }); var slider = new Slider({ node: query('.slider')[0], duration: 500, slideCount: 5 }); slider.startup(); return Slider; });
Bottom of Page
In Head
On Load
On Ready
Setting
Validate
Copy
Format
.container { width: 650px; height: 200px; } .viewport { width: 532px; overflow: hidden; border: 3px outset #ccc; margin: 5px; float: left; } .slider { position: relative; width: 5000px; overflow: hidden; } ul { overflow: hidden; margin: 0; padding: 0; } li { display: block; float: left; width: 100px; height: 100px; border: 1px solid green; margin: 2px; line-height: 100px; font-size: 30px; background-color: #3D6AA2; color: #eef; text-align: center; } .move { float: left; width: 30px; height: 120px; line-height: 120px; border: 1px solid green; background-color: #ddf; text-align: center; cursor: pointer; }
Setting
Validate
Copy
Format
<div class="container"> <div class="viewport"> <div class="slider"> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <li>8</li> <li>9</li> <li>10</li> <li>11</li> <li>12</li> <li>13</li> <li>14</li> <li>15</li> </ul> </div> </div> </div>
No Doc Type
HTML5
HTML 4.01 Transitional
HTML 4.01 Strict
HTML 4.01 Frameset
XHTML 1.1
XHTML 1.0 Transitional
XHTML 1.0 Strict
XHTML 1.0 Frameset
Copy
Format
Download
×
Code Description
×
Difference of Versions
HTML
CSS
JS
×
JS Error
×
CSS Error
Errors
Warnings
×
JavaScript Setting
JS Libraries:
Chrome Frame 1.0.3
Dojo 1.8.0
Dojo 1.7.3
Dojo 1.7.2
Ext Core 3.1.0
jQuery 1.8.0
jQuery 1.7.2
jQuery 1.6.0
jQuery 1.5.0
jQuery 1.4.4
jQuery 1.4.0
jQuery-min 1.7.2
jQueryUI-min 1.8.21
MooTools more-1.4.0.1-full
MooTools core-1.4.5-full
MooTools core-1.4.1-full
Prototype 1.7.1.0
script.aculo.us 1.9.0
SWFObject 2.2
Twitter Bootstrap 2.0.4
WebFont Loader 1.0.28
yui 3.5.1
User Libraries:
Upload File
JavaScript URL(s):
×
CSS Setting
CSS Libraries:
jQueryUI 1.8.21
Twitter Bootstrap 2.0.4
User Libraries:
Upload File
CSS URL(s):