javascript - float 元素和使用 jQuery

标签 javascript jquery css

我有一个 Logo 网格,横向 5 个,向下 4 个。

当用户点击任何 Logo 时,该 Logo 将被插入网格并退出网站。在单击第 5 个 Logo 之前,一切都运行得非常顺利。您可以在这里尝试:

logo hider

关于如何在单击第 5 个时更正 Logo 跳转的任何想法?

这是我的 jQuery:

    $(document).ready(function() {

$('.imageShowing').click(function() {

        if ($(':animated').length) {
        return false;
                    }
  $(this).animate({
    zIndex: '1',
    height: '100',
    width: '140',
    marginTop: '14px',
    marginLeft: '20px',
    marginRight: '20px',
    marginBottom: '14px',
  }, 100, function() {


    $(this).rotate({ angle:0,animateTo:90,easing: $.easing.easeInOutExpo })

    $(this).animate({
    zIndex: '1',
    top: '480',
    opacity: '0'
  }, 1000, function() {  
  $(this).hide("fast");  
    // Animation complete.
  });
  });
});

}); //end document.ready

我的 CSS:

#wrapper { width: 1000px; margin: 0 auto; height: 1000px; position: relative;}
#grid {width: 935px; height: 531px; margin: 0 auto; background: url(images/grid.png) no-repeat center; padding:39px 4px 39px 11px; position: relative; z-index: 5;}
#logoWrapper {position: absolute; top: 38px; left: 36px }
#logoWrapper img { float: left; padding: 0 7px 6px 0; margin:0; position: relative; z-index: 6;}

#bottom { height: 500px; width: 950px; background: #fff; margin: 0 auto; position: relative; z-index: 10;}

HTML 非常简单。感谢您的帮助。

最佳答案

我建议将其设为无序列表,这既是因为它会让您想做的事情更容易,也是出于语义目的。

然后,您可以定位您的 <li> s 是相对的,里面的图像是绝对的。这样动画图像就不会破坏网格的布局。只需隐藏 <li>在最后,而不仅仅是图像。

关于javascript - float 元素和使用 jQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10148403/

相关文章:

javascript - 拦截 XMLHttpRequest javascript 的请求 header

jquery - 谷歌浏览器不显示箭头标志

html - dl 元素分组

javascript - animate() jquery 在我的例子中失败了

javascript - javascript 中的正则表达式和字符串有什么区别?

javascript - 谷歌地图 API V3 : How to get multiple path distances using direction from a point A to point B

c# - 页面方法和安全

c# - 如何在 mvc 4 razor 的数据库中保存嵌套的可排序菜单?

javascript - scrollLeft 使用 -webkit-overflow-scrolling : touch 自动返回到旧位置

css - 是否可以根据正则表达式而不是字符在 Textmate 中使用 Tab 键触发片段?