作为新的jQuery我无法合并代码有一个div从左侧到右侧然后slidedown动画。滑动前div的高度约为10px,然后滑动到全高351px。 我可以设法做到上述分开但不合并!希望能有一点指导,谢谢。 这是我现在的代码;动画一个div,也让它滑动
$.hideAllExcept = function(tabs,boxes){
function init() {
// make it bookmarkable/refreshable. but, no history.
var hash = window.location.hash;
(!hash) ? hideShow('#' + $(boxes+':first').attr('id')) : hideShow(window.location.hash);
// add click handler.
$(tabs).click(function(e) {
e.preventDefault();
var href = $(this).attr('href');
// add back the hash which is prevented by e.preventDefault()
window.location.hash = href;
hideShow(href);
});
}
function hideShow(el) {
$(boxes).animate({"left": "-650px"}, "slow");
$(el).fadeIn('slow').animate({"left" : "60%",height:"351" }, 1000);
$(tabs).removeClass('active');
$('a[href="' + el + '"]').addClass('active');
}
init();
};
取得了一点进步! 我有它运行的临时服务器上:
http://www.tridentsolutions.co.nz/test-folder/index.html#construction_home
但我不能让箱子返回到LHS也看到文字是如何可见的,因为文字是在html和不是div中的图像,这是否意味着我无法隐藏文字? 在此先感谢
(function($){
$.hideAllExcept = function(tabs,boxes){
function init() {
// make it bookmarkable/refreshable. but, no history.
var hash = window.location.hash;
(!hash) ? hideShow('#' + $(boxes+':first').attr('id')) : hideShow(window.location.hash);
// add click handler.
$(tabs).click(function(e) {
e.preventDefault();
var href = $(this).attr('href');
// add back the hash which is prevented by e.preventDefault()
window.location.hash = href;
hideShow(href);
});
}
function hideShow(el) {
$(el).animate({"left": "-650px"}, "slow").fadeIn('slow');
$(el).fadeIn('slow').animate({"left" : "60%" }, 1000).animate({"height" : "351" }, 1000);
$(tabs).removeClass('active');
$('a[href="' + el + '"]').addClass('active');
}
init();
};
对不起,就不能得到这项工作。 – gofer
你试过什么代码?它做了什么? –
感谢您的回复, – gofer