-2
好的,我有一個ajax腳本。 它與jQuery 1.4.4和jQuery地址1.3.2結合在一起。 基本上,我希望它淡入淡出div而不是現在改變它。我希望它看起來更加流暢。使用jQuery褪色AJAX
這是AJAX:
jQuery.noConflict()
if(window.location.hash == "") {
window.location.href = "#home";
}
jQuery(document).ready(function(event) {
jQuery.address.change(onAddressChange);
jQuery('a[href=' + window.location.hash + ']').addClass('selected');
jQuery('a[rel=ajax]').click(function (evt) {
evt.preventDefault();
var hash = evt.target.href;
hash = hash.replace(/^.*#\//, '');
jQuery.address.value(hash);
jQuery('#content').hide();
jQuery('.loading').show();
});
});
// Handles forms
$('form').live('submit', function() {
var hash = window.location.hash.replace('#', '');
hash = $.browser.mozilla ? hash : decodeURIComponent(hash);
if($(this).attr('action') == '') $(this).attr('action', hash);
$(this).append('<input type="hidden" name="submit" value="submit" />');
var data = $(this).serialize();
$.post('loader.php?page=' + $(this).attr('action'), data, function(response, status) {
if(status == 'error') return false;
$('#content').html(response);
});
return false;
});
// End forms
function onAddressChange(evt) {
var page = evt.value.replace(/[#!\/]/, '');
jQuery('a[rel=ajax]').removeClass('selected');
jQuery('#'+page).addClass('selected');
var data = 'page=' + encodeURIComponent(page);
jQuery.ajax({
url: "loader.php",
type: "GET",
data: data,
cache: false,
success: function (html) {
jQuery('.loading').hide();
jQuery('#content').html(html);
jQuery('#content').fadeIn('slow');
}
});
}
我不代碼JS。這是由一位朋友提供給我的。所以如果有人可以讓我淡入淡出,我會感激不盡。
如果你需要它:www.julake.co.uk/staff/media_123
這是一個工作示例:www.44lizards.com/ajaxcodedrop
沒有。仍然沒有這樣做。 – futureslay 2012-03-04 18:47:34