Wednesday, July 23, 2008

Code example for the jQuery demo

Here is the working code I was trying to demonstrate for you tonight. jQuery is a great library that really makes javascript writing a lot easier once you get the general idea. You can learn more about jQuery on their website.
Styles:

ul {
list-style-type: none;
}
.nav {
display: block;
padding: 5px;
width: 150px;
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
font-weight: normal;
text-decoration: none;
}
.active {
font-weight: bold;
background-color: #BFDEDF;
}

Javascript (using jQuery to help out)
$(document).ready(function(){
$("a").hide();
$("a").fadeIn("slow");

$("a").mouseover(function(){
$(this).addClass("active");
});
$("a").mouseout(function(){
$(this).removeClass("active");
});

});
Tonight we got to talk about how to create and work with Dreamweaver Templates. If you were out, just follow the examples in chapter eleven of your book and you'll be fine. We also talked about javascript for just a minute and I used the above example to show how a bit of javascript combined with the trick of assigning multiple classes to the same element can produce a cool effect. See you next Monday! Only two more classes left!!! :(

No comments: