jquery BA BBQ添加动画
我想修改一下。我想添加一些动画 我尝试用如下动画替换show()和hide()函数:jquery BA BBQ添加动画,jquery,animation,Jquery,Animation,我想修改一下。我想添加一些动画 我尝试用如下动画替换show()和hide()函数: $( '.bbq-content' ).animate({ height: "100%" },1000); 但它不能正常工作 我不知道在哪里替换原始jQuery中的代码: $(function(){ // Keep a mapping of url-to-container for caching purposes. var cache = { // If url is '' (no
$( '.bbq-content' ).animate({ height: "100%" },1000);
但它不能正常工作
我不知道在哪里替换原始jQuery中的代码:
$(function(){
// Keep a mapping of url-to-container for caching purposes.
var cache = {
// If url is '' (no fragment), display this div's content.
'': $('.bbq-default')
};
// Bind an event to window.onhashchange that, when the history state changes,
// gets the url from the hash and displays either our cached content or fetches
// new content to be displayed.
$(window).bind( 'hashchange', function(e) {
// Get the hash (fragment) as a string, with any leading # removed. Note that
// in jQuery 1.4, you should use e.fragment instead of $.param.fragment().
var url = $.param.fragment();
// Remove .bbq-current class from any previously "current" link(s).
$( 'a.bbq-current' ).removeClass( 'bbq-current' );
// Hide any visible ajax content.
$( '.bbq-content' ).children( ':visible' ).hide();
// Add .bbq-current class to "current" nav link(s), only if url isn't empty.
url && $( 'a[href="#' + url + '"]' ).addClass( 'bbq-current' );
if ( cache[ url ] ) {
// Since the element is already in the cache, it doesn't need to be
// created, so instead of creating it again, let's just show it!
cache[ url ].show();
} else {
// Show "loading" content while AJAX content loads.
$( '.bbq-loading' ).show();
// Create container for this url's content and store a reference to it in
// the cache.
cache[ url ] = $( '' )
// Append the content container to the parent container.
.appendTo( '.bbq-content' )
// Load external content via AJAX. Note that in order to keep this
// example streamlined, only the content in .infobox is shown. You'll
// want to change this based on your needs.
.load( url, function(){
// Content loaded, hide "loading" content.
$( '.bbq-loading' ).hide();
});
}
})
// Since the event is only triggered when the hash changes, we need to trigger
// the event now, to handle the hash the page may have loaded with.
$(window).trigger( 'hashchange' );
});`
$(函数(){
//保留url到容器的映射以用于缓存。
变量缓存={
//如果url为“”(无片段),则显示此div的内容。
'':$('.bbq默认值')
};
//将事件绑定到window.onhashchange,当历史记录状态更改时,
//从哈希中获取url,并显示缓存内容或回迁
//要显示的新内容。
$(窗口).bind('hashchange',函数(e){
//将散列(片段)作为字符串获取,删除任何前导字符
//在jQuery1.4中,应该使用e.fragment而不是$.param.fragment()。
var url=$.param.fragment();
//从任何以前的“当前”链接中删除.bbq当前类。
$('a.bbq-current')。removeClass('bbq-current');
//隐藏任何可见的ajax内容。
$('.bbq content').children(':visible').hide();
//仅当url不为空时,才将.bbq当前类添加到“当前”导航链接。
url&&$('a[href=“#”+url+'“]')。addClass('bbq current');
如果(缓存[url]){
//由于元素已经在缓存中,因此不需要将其删除
//已创建,因此,与其再次创建,不如让我们展示它!
缓存[url].show();
}否则{
//在加载AJAX内容时显示“加载”内容。
$('.bbq loading').show();
//为该url的内容创建容器,并在中存储对其的引用
//缓存。
缓存[url]=$('')
//将内容容器附加到父容器。
.appendTo(“.bbq content”)
//通过AJAX加载外部内容
//例如,仅显示.infobox中的内容
//希望根据您的需要对此进行更改。
.load(url,函数(){
//加载内容,隐藏“加载”内容。
$('.bbq loading').hide();
});
}
})
//由于事件仅在哈希更改时触发,因此我们需要触发
//事件,以处理页面可能已加载的哈希。
$(window.trigger('hashchange');
});`
对不起,我是法国人