鼠标经过隐藏图片显示文字

JavaScript Code
- <script>
- $(document).ready(function() {
- //if mouse over and mouse out
- $('.eff').hover(
- function () {
- value = $(this).find('img').outerHeight() * -1;
- //for left/right if you have different width and height,
- //commented out because we are using up/down in this example
- //value = $(this).find('img').outerWidth() * -1);
- //animate the image
- // you can change the sliding direction by changing bottom to left, right or top
- // if you changed this, you will have to change the position of the hover out as well
- $(this).find('img').stop().animate({bottom: value} ,{duration:500, easing: 'easeOutBounce'});
- },
- function () {
- //reset the image
- // the position property (bottom), it must be same with the on in the mouseover
- $(this).find('img').stop().animate({bottom:0} ,{duration:500, easing: 'easeOutBounce'});
- });
- //if user clicked on the thumbnail
- $('.eff').click(function () {
- //grab and execute the first link in the thumbnail
- window.location = $(this).find('a:first').attr('href');
- });
- });
- </script>
XML/HTML Code
- <div class="eff">
- <img src="1.gif" alt="Test 1" title="" width="126" height="126" />
- <div class="caption"><a href="http://www.freejs.net" class="header">www.freejs.net</a></div>
- </div>
- <div class="eff">
- <img src="2.gif" alt="Test 1" title="" width="126" height="126" />
- <div class="caption"><a href="http://www.freejs.net" class="header">Umbrella</a><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p></div>
- </div>
- <div class="eff">
- <img src="3.gif" alt="Test 1" title="" width="126" height="126" />
- <div class="caption"><a href="http://www.freejs.net" class="header">Maximum</a><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p></div>
- </div>
- <div class="clear"></div>
原文地址:http://www.freejs.net/article_jquerywenzi_107.html
最近更新
- 响应式全屏手风琴菜单,同时支持垂直方...
- 分组select选择器,支持多选和单...
- jQuery时间日期选择器代码日历插...
- Select 选择器 可以清空的单选...
- jQuery json 无刷新翻页 ...
- 纯css3带倒影效果的图片翻转特效
我爱薅羊毛
点击最多
广告赞助
相关文章
- jquery点击显示或隐藏内容,可以一次展开多个和...
- tooltips/弹出层/消息提示效果,支持点击与...
- jQuery幸运大转盘抽奖活动代码
- jquery来实现的添加商品和减少商品数量,用于购...
- jQuery手机端弹出层提示对话框
- php js实现拖动滑块完成拼图验证码