首先,我总结一下我写的首页的功能和样式。首页是长这样的喔们需要为静态页面设置样式让它动起来。

当鼠标悬浮在新手入门的时候,下拉框缓缓下拉,当鼠标远离时,下拉框缓缓上升,直至消失。这功能听起来感觉很简单,没错代码也简单。

这一块是让书只在这一个位置。随着页面滚动,他的位置不会发生改变。

$("#dd_close").click(function(){//关闭广告
$(this).parent().remove();
});
//右上角的偏移//位置定位
var one=parseInt($("#right").css("top"));
var two=parseInt($("#right").css("left"));

$(window).scroll(function(){//页面改变的方法

var scrollTop=parseInt($(this).scrollTop());
$("#right").offset({top:scrollTop+one});

});

书讯快递的向上滚动

//书讯快递循环垂直向上滚动
function movedome(){
var marginTop=0;//定义一个变量
var stop=false;//设置定时器false;
var interval=setInterval(function(){//开启定时器事件:
if(stop) return;//如果开始就不动:定时器的变量制false;
$("#express").children("li").first().animate({"margin-top":marginTop--},0,function(){
var $first=$(this);
if(!$first.is(":animated")){
if((-marginTop)>$first.height()){
$first.css({"margin-top":1}).appendTo($("#express"));//追加一个express让他一直循环
marginTop=0;//当值变为0的时候,marginTop变为0,距离
}
}
});
},50);//0.05秒
$("#express").mouseover(function(){//当鼠标移上时
stop=true;//开始停?
}).mouseout(function(){
stop=false;//开始动
});
}
movedome();//走到这个方法就走这,在方法外部定义

让图片变大,缩小

function changeImg(){
var index=0;//当前元素
var stop=false;//不停的时候
var $li=$("#content").find("#scroll_img").children("li");//找到子元素
var $page = $("#content").find("#scroll_number").children("li");//找到数字元素
$page.eq(index).addClass("scroll_number_over").stop(true,true).siblings().removeClass("scroll_number_over");
$page.mouseover(function(){
stop=true;
index=$page.index($(this));
$li.eq(index).stop(true,true).fadeIn().siblings().fadeOut();
$(this).addClass("scroll_number_over").stop(true,true).siblings().removeClass("scroll_number_over");
}).mouseout(function(){
stop=false;
});
setInterval(function(){
if(stop) return;
index++;
if(index>=$li.length){
index=0;
}
$li.eq(index).stop(true,true).fadeIn().siblings().fadeOut();
$page.eq(index).addClass("scroll_number_over").stop(true,true).siblings().removeClass("scroll_number_over");
},3000);0
}
changeImg();

var $getBookList = $('#product_storyList_content').html();//把这个获取到的元素赋值到内存中
//大图模式(从列表的DOM中获取信息)
function getBigBookList() {
var $listBookImg = $(' .product_storyList_content_left');//找寻图书列表
var $contents = "";
$(".product_storyList_content_right").find("ul").each(function (i, e) {//找到ul遍历遍历后
var $content = ["<div class='big_img_list'><ul><li class='bookImg'>" + $listBookImg.eq(i).html() + "</li>"];
var $print = $(e).children("li").eq(6).find('span');//
$content.push("<li><dl><dd>" + $print.eq(1).text() + "</dd><dd class='product_content_delete'>" + $print.eq(2).text() + "</dd><dd>" + $print.eq(0).text() + "</dd>")
$content.push("<li class='detail'>" + $(e).children("li").eq(5).text() + "</li>")//简介
$content.push("<li class='detail'>" + $(e).children("li").eq(2).text() + "</li>")//作者
$content.push("<li class='detail'>" + $(e).children("li").eq(1).text() + "</li>")//顾客评分
$content.push("<li class='detail'>" + $(e).children("li").eq(3).text() + "</li>")//出版时间
$content.push("<li class='detail'>" + $(e).children("li").eq(4).text() + "</li></ul></div>")//出版评分
$contents += $content.join("");//添加到contents
})
return $contents;
}
var $bigBookList = getBigBookList();
//单击列表模式和大图模式进行切换
$('#product_array').children().click(function() {
$(this).addClass("click").siblings().removeClass("click");
//使用attr判断this是列表还是大图
if($(this).attr("name") == "array") {
$('#product_storyList_content').html($getBookList);
} else if($(this).attr("name") == "bigImg") {
$('#product_storyList_content').html($bigBookList);
$("#product_storyList_content").children().find("ul").hover(function() {
$(this).addClass("over");
$(this).parent().addClass("over");
}, function() {
$(this).removeClass("over");
$(this).parent().removeClass("over");
})
}
})
})

购物车页面是个比较棘手的问题。

//商品隔行变色
$("#myTableProduct").find("tr:odd").css("backgroundColor","#ffebcd");
//商品变色
$("#myTableProduct").find("tr").mouseover(function(){
$(this).css("backgroundColor","#fff");
}).mouseout(function(){
if($("#myTableProduct").find("tr").index($(this))%2==1) {//判断是否奇数行
$(this).css("backgroundColor","#ffebcd");
}else{
$(this).css("backgroundColor","pink");
}
});

//商品总价:

function totalPrice(){
var percents= 0,prePrices= 0,prices=0;//积分,原价,现价
$("#myTableProduct").find("tr").each(function(i,ele){
var num=$(ele).find(".shopping_product_list_5").find("input").val();//数量
percents+=parseInt($(ele).find(".shopping_product_list_2").text())*num;
//解决下js中浮点数的bug问题,因此建议浮点数的运算不要放在前台,这里是指粗略的解决了一下
var price=parseInt($(ele).find(".shopping_product_list_4").find("label").text().replace(".",""))*num;
prices+=price;
var prePrice=parseInt($(ele).find(".shopping_product_list_3").find("label").text().replace(".",""))*num;
prePrices+=prePrice;
});
$("#product_integral").text(percents);
$("#product_total").text(prices/100);
$("#product_save").text((prePrices-prices)/100);
return prices/100;
}

//修改数量
$("#myTableProduct").find(".shopping_product_list_5").children("input").change(function(){
var value=$(this).val();
if((value == "")||!(/^[0-9]*[1-9][0-9]*$/.test(value))){
alert("数量不能为空,且只能为正整数");
$(this).val(1);
}
var t =totalPrice();
alert("修改成功!,您的商品总金额是"+t+"元");
});

totalPrice();
//删除商品
$("#myTableProduct").find(".shopping_product_list_6").children("a").click(function(){
if(confirm("您确定要删除商品么?")){
$(this).parent().parent().remove();
totalPrice();
}
});

转载于:https://www.cnblogs.com/hualishu/p/8890313.html

jquery蔚蓝网总结三个页面相关推荐

  1. Web前端JQuery面试题(三)

    Web前端JQuery面试题(三) 1.怎么阻止冒泡过程? stopPropagation(); // 阻止冒泡过程 2.ready()方法和onload()方法的区别? onload()方法要等页面 ...

  2. jQuery框架学习第三天:如何管理jQuery包装集

    jQuery框架学习第一天:开始认识jQuery jQuery框架学习第二天:jQuery中万能的选择器 jQuery框架学习第三天:如何管理jQuery包装集 jQuery框架学习第四天:使用jQu ...

  3. 从零开始学前端:jQuery官网 --- 今天你学习了吗?(CSS:Day26)

    从零开始学前端:程序猿小白也可以完全掌握!-今天你学习了吗?(CSS) 复习:从零开始学前端:标签渐变和媒体查询 - 今天你学习了吗?(CSS:Day25) 文章目录 从零开始学前端:程序猿小白也可以 ...

  4. jQuery实现AJAX定时刷新局部页面实例

    欢迎访问爱极客官方论坛,期待与你一起改变世界! 方法一: 局部刷新我们讲述到最多的是ajax 了,当然也可以不使用ajax来刷新页面了,我们可以使用jquery中的append来给指定内容加东西了,当 ...

  5. jquery官网(jquery下载官网)

    官网在哪里 官网 官方论坛 如何学习jquery 新手想要学习jQuery,可以从书籍和教程两个方面来学习. 你在公司是怎么用jquery的? 在公司使用jQuery插件,使用方法有如下几个步骤: 一 ...

  6. 如何在jQuery官网下载库文件!

    jQuery官网 http://jquery.com/ 1. 首先让我们在浏览器上登陆 jQuery的官方网站并且点击右边的  Download jQuery 2. 页面如下图有很多英文  不用担心  ...

  7. HTML5响应式手机模板:H5网站设计——政府街道社区wap微信官网模板(11个页面) HTML+CSS+JavaScript 手机模板wap 手机网站模板 企业手机网站模板...

    HTML5响应式手机模板:H5网站设计--政府街道社区wap微信官网模板(11个页面) HTML+CSS+JavaScript 手机模板wap 手机网站模板 企业手机网站模板 H5手机网站模板 响应式 ...

  8. Jquery实现英雄联盟游戏查找页面出现的bug及解决方案

    JQuery实现英雄联盟英雄查找页面出现的bug汇总 1.on.("click","li,function(){ })绑定li中button按钮重复根据li点击次数重复执 ...

  9. jQuery怎么加载一个html页面到我指定的div里面

    一.jQuery怎么加载一个html页面到我指定的div里面.(来自百度知道) 我想把a.html里面的某一部份的内容加载到b.html的一个div里. 比如,我要加载a.html里面的<div ...

  10. Android仿网易云音乐播放页面 背景虚化碟片效果

    1.效果图 仿网易云音乐播放页面,主要有4个关键点: 背景虚化.获取音乐的专辑封面,将此图片作为背景图,并进行模糊虚化处理 碟片合成.获取音乐的专辑封面,和黑色碟片图片进行合成 碟片旋转.音乐播放时, ...

最新文章

  1. linux将mysql的错误连接数_Mysql学习笔记(十二) 并发参数调节
  2. KVM虚拟机IO处理过程(一) ----Guest VM I/O 处理过程
  3. 在Spark上用Scala实验梯度下降算法
  4. C# 依赖注入那些事儿
  5. 中小学生学python_《中小学生Python编程入门指南》 附录一
  6. ROS中阶笔记(八):机器人SLAM与自主导航—机器人自主导航
  7. 通过 AnyTrans 将照片从 Mac 传输到 iPhone,无需 iTunes
  8. windows 消息
  9. 在本地视频播放中硬解与软解的能耗比体现
  10. 机器学习之K均值聚类算法
  11. 改进YOLOv7系列:23.YOLOv7添加CBAM注意力机制
  12. java rfc接口_java调用sap的RFC接口
  13. Terraria(泰拉瑞亚)存档覆盖(Linux)
  14. 两点分布和二项分布的特征函数
  15. 数控技能大赛计算机程序设计员,第八届全国数控技能大赛决赛获奖名单
  16. 如何把视频嵌入PPT合为一个文件
  17. 疫情下失业开发即时通讯软件(仿微信)-优化服务器端吞吐量
  18. Android自定义Dialog(仿QQ同步助手退出对话框)
  19. POJ的题目分类(两个版本)
  20. 黑客术语大全及其解释

热门文章

  1. python 稠密重建_使用openMVG+PMVS实现视觉三维重建
  2. 华为计算机系统叫什么,华为MateBook操作系统是什么
  3. 显卡更新显示计算机无法识别,显卡驱动更新不了怎么办 显卡驱动更新不了解决方法...
  4. JMeter使用实践之造数据
  5. 2016.4.6海淀驾校考试科目二
  6. 为什么下载eclipse很慢很慢
  7. 移动硬盘只显示盘符,不显示容量,也不能打开
  8. iPhone, iPad 安装 ipa 文件
  9. 【Arcgis】Extract by Mask时出错,ERROR 999999
  10. 计算机编程入门先学什么最好?