我爱模板网 > CSS模板 > 个人博客 >  书签页效果个人博客html5模板正文

书签页效果个人博客html5模板

个人博客html模板
个人博客html模板

    这是一款设计非常清新的书签页效果的个人博客HTML5模板,整个页面采用了淡淡的褐色网格作为背景,页面被一道“尺子”和“订书线”垂直的分成两部分,左边为书签效果的跟随滚轮滚动的导航,右边是正文。
    banner滚动没有采用插件,而是自己封装的插件,带缩略图预览和左右箭头。代码如下,可以自己研究下用在其他项目中,由于代码比较简单,并且有英文注释,这里不多做解释:
$(function() {
 //some elements..
 var $ps_container = $('#ps_container'),
 $ps_image_wrapper  = $ps_container.find('.ps_image_wrapper'),
 $ps_next = $ps_container.find('.ps_next'),
 $ps_prev = $ps_container.find('.ps_prev'),
 $ps_nav = $ps_container.find('.ps_nav'),
 $tooltip = $ps_container.find('.ps_preview'),
 $ps_preview_wrapper = $tooltip.find('.ps_preview_wrapper'),
 $links = $ps_nav.children('li').not($tooltip),
 total_images = $links.length,
 currentHovered = -1,
 current = 0,
 $loader = $('#loader');
 
 /*check if you are using a browser*/ 
 var ie  = false;
 if ($.browser.msie) {
 ie = true;//you are not!Anyway let's give it a try
 }
 if(!ie)
 $tooltip.css({
 opacity : 0
 }).show();
 
 
 /*first preload images (thumbs and large images)*/
 var loaded = 0;
 $links.each(function(i){
 var $link  = $(this);
 $link.find('a').preload({
 onComplete : function(){
 ++loaded;
 if(loaded == total_images){
 //all images preloaded,
 //show ps_container and initialize events
 $loader.hide();
 $ps_container.show();
 //when mouse enters the pages (the dots),
 //show the tooltip,
 //when mouse leaves hide the tooltip,
 //clicking on one will display the respective image 
 $links.bind('mouseenter',showTooltip)
   .bind('mouseleave',hideTooltip)
   .bind('click',showImage);
 //navigate through the images
 $ps_next.bind('click',nextImage);
 $ps_prev.bind('click',prevImage);
 }
 }
 });
 });
 
 function showTooltip(){
 var $link = $(this),
 idx = $link.index(),
 linkOuterWidth = $link.outerWidth(),
 //this holds the left value for the next position
 //of the tooltip
 left = parseFloat(idx * linkOuterWidth) - $tooltip.width()/2 + linkOuterWidth/2,
 //the thumb image source
 $thumb = $link.find('a').attr('rel'),
 imageLeft;
 
 //if we are not hovering the current one
 if(currentHovered != idx){
 //check if we will animate left->right or right->left
 if(currentHovered != -1){
 if(currentHovered < idx){
 imageLeft = 75;
 }
 else{
 imageLeft = -75;
 }
 }
 currentHovered = idx;
 
 //the next thumb image to be shown in the tooltip
 var $newImage = $('<img/>').css('left','0px')
    .attr('src',$thumb);
 
 //if theres more than 1 image 
 //(if we would move the mouse too fast it would probably happen)
 //then remove the oldest one (:last)
 if($ps_preview_wrapper.children().length > 1)
 $ps_preview_wrapper.children(':last').remove();
 
 //prepend the new image
 $ps_preview_wrapper.prepend($newImage);
 
 var $tooltip_imgs = $ps_preview_wrapper.children(),
 tooltip_imgs_count = $tooltip_imgs.length;
 
 //if theres 2 images on the tooltip
 //animate the current one out, and the new one in
 if(tooltip_imgs_count > 1){
 $tooltip_imgs.eq(tooltip_imgs_count-1)
  .stop()
  .animate({
 left:-imageLeft+'px'
   },150,function(){
 //remove the old one
 $(this).remove();
   });
 $tooltip_imgs.eq(0)
  .css('left',imageLeft + 'px')
  .stop()
  .animate({
 left:'0px'
   },150);
 }
 }
 //if we are not using a "browser", we just show the tooltip,
 //otherwise we fade it
 //
 if(ie)
 $tooltip.css('left',left + 'px').show();
 else
 $tooltip.stop()
 .animate({
 left : left + 'px',
 opacity : 1
 },150);
 }
 
 function hideTooltip(){
 //hide / fade out the tooltip
 if(ie)
 $tooltip.hide();
 else
 $tooltip.stop()
     .animate({
 opacity : 0
 },150);
 }
 
 function showImage(e){
 var $link = $(this),
 idx = $link.index(),
 $image = $link.find('a').attr('href'),
 $currentImage  = $ps_image_wrapper.find('img'),
 currentImageWidth = $currentImage.width();
 
 //if we click the current one return
 if(current == idx) return false;
 
 //add class selected to the current page / dot
 $links.eq(current).removeClass('selected');
 $link.addClass('selected');
 
 //the new image element
 var $newImage = $('<img/>').css('left',currentImageWidth + 'px')
    .attr('src',$image);
 
 //if the wrapper has more than one image, remove oldest
 if($ps_image_wrapper.children().length > 1)
 $ps_image_wrapper.children(':last').remove();
 
 //prepend the new image
 $ps_image_wrapper.prepend($newImage);
 
 //the new image width. 
 //This will be the new width of the ps_image_wrapper
 var newImageWidth = $newImage.width();
 
 //check animation direction
 if(current > idx){
 $newImage.css('left',-newImageWidth + 'px');
 currentImageWidth = -newImageWidth;
 } 
 current = idx;
 //animate the new width of the ps_image_wrapper 
 //(same like new image width)
 $ps_image_wrapper.stop().animate({
     width : newImageWidth + 'px'
 },350);
 //animate the new image in
 $newImage.stop().animate({
     left : '0px'
 },350);
 //animate the old image out
 $currentImage.stop().animate({
     left : -currentImageWidth + 'px'
 },350);
 
 e.preventDefault();
 } 
 
 function nextImage(){
 if(current < total_images){
 $links.eq(current+1).trigger('click');
 }
 }
 function prevImage(){
 if(current > 0){
 $links.eq(current-1).trigger('click');
 }
 }
});
    “MY RECENT WORK”部分的图片,点击后会弹出放大显示的层,效果是基于 jQuery fancybox弹出层。
    本模板非常适合作为个人博客的模板使用。因为比较有个性。我爱模板网之前也推荐过一款类似的博客模板: Klass木纹背景封面风格个人博客html模板。


部分素材资源来源网站,本站提供免费下载,如有侵权请联系站长马上删除!
下载 预览
上一篇: Moderna白色可切换10中风格的响应式html网站模板 下一篇: 清爽的HTML5+CSS3个人博客html模板
推荐CSS模板/recommond
最新CSS模板/new
热门CSS模板/hot
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
选择头像:
点击我更换图片
发表
最新评论

猜你喜欢



深圳SEO优化公司广州网站优化服务商玩具网站优化怎么做越秀公司网站优化推广技巧南山营销型网站优化成都专业的餐饮行业网站优化池州市网站建设优化郑州个人网站优化赣州网站怎么优化推广扬州网站优化厂商网站优化过度有哪些优化不太好的网站上海网站优化如何做栏目规划自己怎样优化网站云浮外贸网站关键词优化排名宁波网站搜索引擎优化厦门网站首页优化姑苏网站优化价格网站大量大图如何优化重庆市优化网站公司怎么样网站内部优化要求新郑信息化网站搭建优化武汉网站域名优化绍兴网站优化公司哪家好济南网站优化公司哪家效果好惠州网站seo优化设计龙华公司网站优化网站刚做好怎么做优化佛山专业网站优化技巧舟山网站seo如何优化亳州市网站seo优化歼20紧急升空逼退外机英媒称团队夜以继日筹划王妃复出草木蔓发 春山在望成都发生巨响 当地回应60岁老人炒菠菜未焯水致肾病恶化男子涉嫌走私被判11年却一天牢没坐劳斯莱斯右转逼停直行车网传落水者说“没让你救”系谣言广东通报13岁男孩性侵女童不予立案贵州小伙回应在美国卖三蹦子火了淀粉肠小王子日销售额涨超10倍有个姐真把千机伞做出来了近3万元金手镯仅含足金十克呼北高速交通事故已致14人死亡杨洋拄拐现身医院国产伟哥去年销售近13亿男子给前妻转账 现任妻子起诉要回新基金只募集到26元还是员工自购男孩疑遭霸凌 家长讨说法被踢出群充个话费竟沦为间接洗钱工具新的一天从800个哈欠开始单亲妈妈陷入热恋 14岁儿子报警#春分立蛋大挑战#中国投资客涌入日本东京买房两大学生合买彩票中奖一人不认账新加坡主帅:唯一目标击败中国队月嫂回应掌掴婴儿是在赶虫子19岁小伙救下5人后溺亡 多方发声清明节放假3天调休1天张家界的山上“长”满了韩国人?开封王婆为何火了主播靠辱骂母亲走红被批捕封号代拍被何赛飞拿着魔杖追着打阿根廷将发行1万与2万面值的纸币库克现身上海为江西彩礼“减负”的“试婚人”因自嘲式简历走红的教授更新简介殡仪馆花卉高于市场价3倍还重复用网友称在豆瓣酱里吃出老鼠头315晚会后胖东来又人满为患了网友建议重庆地铁不准乘客携带菜筐特朗普谈“凯特王妃P图照”罗斯否认插足凯特王妃婚姻青海通报栏杆断裂小学生跌落住进ICU恒大被罚41.75亿到底怎么缴湖南一县政协主席疑涉刑案被控制茶百道就改标签日期致歉王树国3次鞠躬告别西交大师生张立群任西安交通大学校长杨倩无缘巴黎奥运

深圳SEO优化公司 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化