Хорошо, у меня есть сценарий ajax. В сочетании с jQuery 1.4.4 и jQuery адресом 1.3.2. В принципе, мне бы хотелось, чтобы он исчезал, и вместо него он менялся, как только сейчас. Я хочу, чтобы он выглядел более жидким.Fading AJAX с jQuery
Это 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
Nope. Все еще не делаю этого. – futureslay