OK i'm trying to make an image scroller using jquery work within a frame. I put all the code in banner.html it works fine, but whenever i try to use it within <frame src="banner.html"/> it doesn't load anything into the frame at all.
layout.css
slideshow {
position:relative;
height:400px;
}
slideshow IMG {
position:absolute;
top:0;
left:0;
z-index:8;
opacity:0.0;
}
slideshow IMG.active {
z-index:10;
opacity:1.0;
}
slideshow IMG.last-active {
z-index:9;
}
banner.html
<head>
<link href="layout.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery-1.2.6.min.js"></script>
<script type="text/javascript">
function slideSwitch() {
var $active = $('#slideshow IMG.active');
if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
var $next = $active.next().length ? $active.next()
: $('#slideshow IMG:first');
$active.addClass('last-active');
$next.css({opacity: 0.0})
.addClass('active')
.animate({opacity: 1.0}, 1000, function() {
$active.removeClass('active last-active');});}
$(function() {
setInterval( "slideSwitch()", 5000 );
});
</script>
<div id="slideshow">
<img src="images/banner1.jpg" alt="Contact us" class="active" />
<img src="images/banner2.jpg" alt="Services" />
</div>
</head>
<body>
</body>
nvm i saved the javascript of banner.html into its own .js file and just linked every page to it ty anyways sorry for waste of time.
Nevertheless, your HTML code has an error:
- you should close the HEAD after the CSS and script call(s),
- the DIV needs to be inside BODY (not before).
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)