Google & stackoverflow are our friends.....
Index.html:
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Project List</title>
<link rel="shortcut icon" href="" />
<link rel="stylesheet" href="css/nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="css/sliderstyle.css" type="text/css" media="screen" />
<link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.nivo.slider.pack.js"></script>
<script type="text/javascript" src="js/dropcontent.js"></script>
</head>
<body>
<div id="content">
<div class="work">
<h3>
<img src="images/arrow_open.gif" alt=">" />
<a href="content1.html">Project 1</a>
</h3>
<div class="pictures"></div>
</div>
<div class="work">
<h3>
<img src="images/arrow_open.gif" alt=">" />
<a href="content2.html">Project 2</a>
</h3>
<div class="pictures"></div>
</div>
<div class="work">
<h3>
<img src="images/arrow_open.gif" alt=">" />
<a href="content3.html">Project 3</a>
</h3>
<div class="pictures"></div>
</div>
</div>
</body>
</html>
Content Pages:
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<div id="ajaxContent">
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. </p>
<div id="slider-wrapper">
<div id="slider" class="nivoSlider">
<img src="http://www.sitepoint.com/forums/images/toystory.jpg" alt="" />
<img src="http://www.sitepoint.com/forums/images/up.jpg" alt="" title="This is an example of a caption" /></a>
<img src="http://www.sitepoint.com/forums/images/walle.jpg" alt="" />
<img src="http://www.sitepoint.com/forums/images/nemo.jpg" alt="" title="#htmlcaption" />
</div>
</div>
</div>
</body>
</html>
dropcontent.js:
PHP Code:
jQuery(function($) {
// Adds the open and close effect for anchor links showing work.
$('.work a').click(function(event) {
event.preventDefault();
var parent = $(this).parents(".work");
var content_holder = parent.children(".pictures");
if (parent.hasClass("selected_work")) {
close_other();
return;
}
close_other();
parent.addClass("selected_work");
// Centered Effect updated
content_holder.load(this + " #ajaxContent", function() {
$(this).find('#slider').nivoSlider();
});
$('.selected_work img').attr("src", "http://www.sitepoint.com/forums/images/arrow_close.gif");
});
function close_other() {
var selected_work = $('.selected_work');
selected_work.children('.pictures').empty();
$('.selected_work img').attr("src", "http://www.sitepoint.com/forums/images/arrow_open.gif");
selected_work.removeClass("selected_work")
}
});
sorry about the live method, I thought that would work....
Bookmarks