第二个脚本在使用第一个脚本加载后不起作用
我试图用这个加载它
$(document).ready(function() {
$('div.frame ul#main li a').click(function(){
var toLoad = $(this).attr('href')+' #content';
$('#content').hide('fast',loadContent);
function loadContent() {
$('#content').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#content').show('normal',hideLoader());
}
function hideLoader() {
$('#load').fadeOut('normal');
}
return false;
});
});
加载一页后使用此页
$(document).ready(function(e) {
var currentportfolio = $('div#slider ul li:first-child').addClass('show');
var portfolio = $('div#slider ul li');
$('div#slider ul li').not(':first').hide();
$('.prev, .next').click(function() {
// Determine the direction, -1 is prev, 1 is next
var dir = $(this).hasClass('prev') ? -1 : 1;
// Get the li that is currently visible
var current = $('div#slider ul li:visible');
// Get the element that should be shown next according to direction
var new_el = dir < 0 ? current.prev('li') : current.next('li');
// If we've reached the end, select first/last depending on direction
if(new_el.size() == 0) {
new_el = $('div#slider ul li:'+(dir < 0 ? 'last' : 'first'));
}
// Hide them all..
$('div#slider ul li').hide();
// And show the new one
new_el.show();
// Prevent the link from actually redirecting the browser somewhere
return false;
});
});
我是 jQuery 新手。提前致谢。