Click here to Skip to main content
15,891,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTML
<html 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Slideshow With Buttons</title>
<style type="text/css">
ul.ppt {
	position: relative;
}

.ppt li {
	list-style-type: none;
	position: absolute;
	top: 0;
	left: 0;
}

.ppt img {
	border: 1px solid #e7e7e7;
	padding: 5px;
	background-color: #ececec;
}
</style>
</head>
<body>
<button type="button" id="back">Back</button>
<button type="button" id="stop">Pause</button>
<button type="button" id="play">Play</button>
<button type="button" id="fwd">Forward</button>

<ul class="ppt">
	<li><img src="ethernet.jpg" alt="Ethernet Cable"></img></li>
	<li><img src="glasses.jpg" alt="Spectacles"></img></li>
	<li><img src="pisa.jpg" alt="Leaning Tower of Pisa"></img></li>
</ul>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$('.ppt li:gt(0)').hide();
$('.ppt li:last').addClass('last');
$('.ppt li:first').addClass('first');
$('#play').hide();

var cur = $('.ppt li:first');
var interval;

$('#fwd').click( function() {
	goFwd();
	showPause();
} );

$('#back').click( function() {
	goBack();
	showPause();
} );

$('#stop').click( function() {
	stop();
	showPlay();
} );

$('#play').click( function() {
	start();
	showPause();
} );

function goFwd() {
	stop();
	forward();
	start();
}

function goBack() {
	stop();
	back();
	start();
}

function back() {
	cur.fadeOut( 1000 );
	if ( cur.attr('class') == 'first' )
		cur = $('.ppt li:last');
	else
		cur = cur.prev();
	cur.fadeIn( 1000 );
}

function forward() {
	cur.fadeOut( 1000 );
	if ( cur.attr('class') == 'last' )
		cur = $('.ppt li:first');
	else
		cur = cur.next();
	cur.fadeIn( 1000 );
}

function showPause() {
	$('#play').hide();
	$('#stop').show();
}

function showPlay() {
	$('#stop').hide();
	$('#play').show();
}

function start() {
	interval = setInterval( "forward()", 3000 );
}

function stop() {
	clearInterval( interval );
}

$(function() {
	start();
} );
</script>
</body>
</html></head>
Posted
Updated 10-Sep-12 8:10am
v3
Comments
AspDotNetDev 10-Sep-12 14:04pm    
What is your question?
revu0089 10-Sep-12 14:13pm    
i want to remove "<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>" this website link..is there any way without affecting the slide show
[no name] 10-Sep-12 14:13pm    
What dollar sign, what URL and what code?
revu0089 10-Sep-12 14:14pm    
i have removed this link and after that the play pause next and previous buttons are not working..also the slideshow isnt workng
revu0089 10-Sep-12 14:14pm    
http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js.........this is the url

1 solution

1) The only website url in this code is a reference to an outdated jquery version. You can get rid of it, if you download the code and add it to your site. I suggest using the minified one. So download this one: http://code.jquery.com/jquery-1.8.1.min.js[^], copy it aside to your code, and change the reference like this:
HTML
<script type="text/javascript" src="jquery-1.8.1.min.js"></script>

2) The dollar sign is the basic function of JQuery.
So: if you remove any of it, you get nothing, since this is a JQuery based code, thus you have to rewrite it to an other ajax library, or to legacy javascript. One might do this, but is is a bad idea, since you can only loose by this step, you will gain nothing at all. But if you stick to it, you have to learn both. You can start here: http://net.tutsplus.com/tutorials/javascript-ajax/from-jquery-to-javascript-a-reference/[^]
 
Share this answer
 
v4
Comments
revu0089 10-Sep-12 14:20pm    
can u plz edit my code and arrange it in the right form
Zoltán Zörgő 10-Sep-12 14:22pm    
See my edited answer, and don't bother the dollar signs.
revu0089 10-Sep-12 14:39pm    
i had done that but the problem is the code becoming much more complex than i expected..ok letme tell u something..i want to create a simple picture gallery slide show with next and previous buttons..also the play and pause in the same button..can u please send me a link or the codes
revu0089 10-Sep-12 14:25pm    
k let me check this..anyway thanks a lot
revu0089 10-Sep-12 14:33pm    
i had done that but the problem is the code becoming much more complex than i expected..ok letme tell u something..i want to create a simple picture gallery slide show with next and previous buttons..also the play and pause in the same button..can u please send me a link or the codes

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900