html图片固定框架,jQuery固定框架

9ae6ec1d62a02d2dba3b02d2a8d73d1b.png

e8ba93fc9d4f649ae1d3cacff2874f8a.png

插件描述:底部和头部固定式HTML框架 固定框架 向下滚动切换顶部导航,底部和头部固定式HTML框架

Framework Fixed jQuery固定框架 向下滚动切换顶部导航,底部和头部固定式HTML框架

实现方法

创建HTML

  • Home
  • About Me
  • Work
  • Blog
  • Contact Us

向下滚动后所出现的顶部导航。

Framework Fixed Html with

CSS & jQueryby Sunflowa Media

  • Home
  • About Me
  • Work
  • Blog
  • Contact Us

中间内容

中间内容

底部固定内容

js

引用jQuery1.4以上版本

// Category Dropdown

jQuery(function($) {

$("#toggle-cat").click(function() {

$("#toggle-client").removeClass("active");

$("#client-filter-panel").hide();

$(this).toggleClass("active");

$("#cat-filter-panel").slideToggle(250);

return false;

});

$("#toggle-client").click(function() {

$("#toggle-cat").removeClass("active");

$("#cat-filter-panel").hide();

$(this).toggleClass("active");

$("#client-filter-panel").slideToggle(250);

return false;

});

});

jQuery(function($) {

$('#toggling').hide();

var footerHeight = $('#footer').outerHeight(true);

$('#footer-toggle').click(function() {

$('#toggling').animate({

'height': 'toggle'

},

500);

$(this).toggleClass('expanded');

return false;

});

});

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是一个基本的主页框架模板的jQuery代码示例: HTML 代码: ``` <!DOCTYPE html> <html> <head> <title>主页</title> <meta charset="UTF-8"> <link href="css/style.css" rel="stylesheet"> <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.14.0/css/all.min.css" rel="stylesheet"> </head> <body> <header> <div class="logo">LOGO</div> <nav> <ul> <li><a href="#">首页</a></li> <li><a href="#">关于我们</a></li> <li><a href="#">服务项目</a></li> <li><a href="#">联系我们</a></li> </ul> </nav> </header> <main> <section class="banner"> <div class="banner-text"> <h1>欢迎来到我们的主页</h1> <p>这里是我们的公司简介和服务介绍</p> <a href="#" class="btn btn-primary">了解更多</a> </div> </section> <section class="services"> <h2>我们的服务</h2> <div class="service-container"> <div class="service"> <i class="fa fa-desktop"></i> <h3>网站设计</h3> <p>我们提供专业的网站设计服务,让您的网站更加美观和实用。</p> </div> <div class="service"> <i class="fa fa-mobile"></i> <h3>移动应用开发</h3> <p>我们拥有经验丰富的移动应用开发团队,为您提供优质的移动应用开发服务。</p> </div> <div class="service"> <i class="fa fa-cog"></i> <h3>IT技术支持</h3> <p>我们提供专业的IT技术支持服务,确保您的业务正常运行。</p> </div> </div> </section> </main> <footer> <p>版权所有 © 2021</p> </footer> <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="js/script.js"></script> </body> </html> ``` CSS 代码: ``` /* Reset CSS */ html, body, header, nav, main, section, article, aside, footer { margin: 0; padding: 0; } /* 页面样式 */ body { font-family: Arial, sans-serif; font-size: 16px; } header { background-color: #333; color: #fff; display: flex; align-items: center; height: 80px; padding: 0 20px; } .logo { font-size: 24px; font-weight: bold; margin-right: auto; } nav ul { list-style: none; display: flex; align-items: center; } nav ul li { margin-right: 20px; } nav ul li a { color: #fff; text-decoration: none; } nav ul li a:hover { text-decoration: underline; } .banner { background-image: url(https://picsum.photos/1200/400); background-size: cover; height: 400px; display: flex; align-items: center; justify-content: center; } .banner-text { text-align: center; } .banner-text h1 { font-size: 36px; margin-bottom: 20px; } .banner-text p { font-size: 18px; margin-bottom: 20px; } .btn { display: inline-block; padding: 10px 20px; border-radius: 5px; font-size: 18px; font-weight: bold; text-align: center; text-decoration: none; color: #fff; background-color: #333; transition: background-color 0.3s ease; } .btn:hover { background-color: #555; } .btn-primary { background-color: #007bff; } .services { padding: 50px 20px; text-align: center; } .services h2 { font-size: 36px; margin-bottom: 50px; } .service-container { display: flex; flex-wrap: wrap; justify-content: center; } .service { width: 300px; margin: 20px; padding: 20px; background-color: #f5f5f5; border-radius: 5px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); text-align: center; } .service i { font-size: 48px; margin-bottom: 20px; color: #007bff; } .service h3 { font-size: 24px; margin-bottom: 20px; } .service p { font-size: 18px; margin-bottom: 20px; } footer { background-color: #333; color: #fff; text-align: center; padding: 20px; } ``` jQuery 代码: ``` $(document).ready(function() { // 导航栏固定 var headerHeight = $('header').outerHeight(); $(window).scroll(function() { if ($(this).scrollTop() > headerHeight) { $('header').addClass('fixed'); } else { $('header').removeClass('fixed'); } }); // 导航栏滚动 $('nav a').click(function(e) { e.preventDefault(); var target = $($(this).attr('href')); if (target.length) { $('html, body').animate({ scrollTop: target.offset().top - headerHeight }, 1000); } }); // 服务项目动画 $('.service').hover(function() { $(this).find('i').addClass('animated pulse'); }, function() { $(this).find('i').removeClass('animated pulse'); }); }); ``` 这是一个基本的主页框架模板,您可以根据您的实际需求进行修改和扩展。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值