i went ahead and updated this sample to use AMD/version 3.8 of our API and on style event listeners.http://jsfiddle.net/jagravois/3rZK5/
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>Basemaps with an Opacity Slider</title>
<link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.8/js/dojo/dijit/themes/nihilo/nihilo.css">
<link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.8/js/esri/css/esri.css">
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
#map{ padding: 0; }
#sliderWrapper {
position:absolute;
right: 30px;
top:30px;
z-Index: 40;
width: 250px;
height: 50px;
background: #fff;
-moz-box-shadow: 0 0 5px #888;
-webkit-box-shadow: 0 0 5px #888;
box-shadow: 0 0 5px #888;
}
#sliderLabels {
position: relative;
top: -1px;
height: 1.2em;
font-size: 80%;
font-weight: bold;
font-family: arial;
color: #444;
padding: 3px;
margin: 5px 10px 0 10px;
}
</style>
<script type="text/javascript">var dojoConfig = { parseOnLoad: true };</script>
<script type="text/javascript" src="http://js.arcgis.com/3.8/"></script>
<script type="text/javascript">
require([
"esri/map",
"esri/layers/ArcGISTiledMapServiceLayer",
"dojo/on",
"dijit/registry",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dijit/form/HorizontalSlider",
"dijit/form/HorizontalRuleLabels"],
function (Map, ArcGISTiledMapServiceLayer, on, registry) {
var map = new esri.Map("map", {
center: [-80,20],
zoom: 3
});
var oceans = new ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer");
map.addLayer(oceans);
var streets = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
map.addLayer(streets);
//wire an event handler for the dojo slider
map.on("load", function() {
on(registry.byId('sliderOpacity'), 'change', changeOpacity);
});
function changeOpacity(op) {
var newOp = (op / 100);
streets.setOpacity(1.0 - newOp);
oceans.setOpacity(newOp);
}
});
</script>
</head>
<body class="nihilo">
<div data-dojo-type="dijit/layout/BorderContainer"
data-dojo-props="design:'headline',gutters:false"
style="width: 100%; height: 100%; margin: 0;">
<div id="map"
data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region:'center'"
style="width: 100%; height: 100%; margin: 0;">
<div id="sliderWrapper"> <!-- slider divs -->
<div id="sliderOpacity"
data-dojo-type="dijit/form/HorizontalSlider"
data-dojo-props="showButtons:'true', value:0, minimum:0, maximum:100, discreteValues:101, intermediateChanges:true">
<ol id="sliderLabels"
data-dojo-type="dijit/form/HorizontalRuleLabels"
data-dojo-props="container:'topDecoration'">
<li>Streets</li>
<li>Oceans</li>
</ol>
</div>
</div> <!-- end slider divs -->
</div>
</div>
</body>
</html>