博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mootools 选项卡_MooTools的搜索类型选项
阅读量:2513 次
发布时间:2019-05-11

本文共 2883 字,大约阅读时间需要 9 分钟。

mootools 选项卡

Advanced search engines like Google, Yahoo!, and Bing have discovered the obvious: one type of search isn't good enough. The big search engines offer web search, video search, code search, blog search, image search, and any other type of search you can think of. Of course they could use different search boxes on different pages but that's annoying. Using a bit of JavaScript we can consolidate all of our search types into one box.

诸如Google,Yahoo!和Bing之类的高级搜索引擎已经发现了显而易见的事实:一种类型的搜索还不够好。 大型搜索引擎提供Web搜索,视频搜索,代码搜索,博客搜索,图像搜索以及您可以想到的任何其他类型的搜索。 当然,他们可以在不同的页面上使用不同的搜索框,但这很烦人。 使用一些JavaScript,我们可以将所有搜索类型整合到一个框中。

HTML / PHP (The HTML / PHP)

Click on the search type headers above the search box to change the type of search you'd like to make!'

 

The HTML structure is simple -- be mindful of the element ID's for styling and JavaScript functionality.

HTML结构很简单-注意样式和JavaScript功能的元素ID。

CSS (The CSS)

#search-container	{ position:relative; padding:10px; -moz-border-radius:10px; -webkit-border-radius:10px; }#search-options		{  }	#search-options a	{ top:-20px; position:absolute; font-size:11px; padding:3px 6px; color:#00f; -moz-border-radius-topleft:5px; -moz-border-radius-topright:5px; -webkit-border-top-left-radius:5px; -webkit-border-top-right-radius:5px; }	#search-options a.active	{ z-index:5; text-decoration:none; font-weight:bold; color:#000; }#query 				{ font-size:24px; padding:4px; background:#fff; }#submit				{ font-size:24px; }.web				{ background:#ccc; }.images				{ background:#fffea1; }.videos				{ background:lightblue; }

Style at will!

随心所欲!

MooTools (The MooTools)

window.addEvent('domready',function() {	var lynx = $$('#search-options a'), activeItem = $$('#search-options a.active')[0] || lynx[0], button = $('submit'), oTerm = 'Search';	var searchForm = $('search-form'), container = $('search-container').set('class',activeItem.get('text').toLowerCase());	lynx.addEvent('click',function(e) {		//brick event		e.stop();		//manage "active" class		activeItem.className = '';		this.addClass('active ' + this.get('text').toLowerCase());		activeItem = this;		//manage URL and color class		searchForm.set('action',this.get('href'));		container.className = this.get('class');		button.set('value',this.get('text') + ' ' + oTerm);	});});

The system works off of a system of adding and removing CSS class names. We also swap the form actions through each search type click.

该系统在添加和删除CSS类名的系统上工作。 我们还会通过每次搜索类型点击来交换表单操作。

Mapping out the the functionality for a system like this is fairly simple. What sets these type of systems is the great styling. Post in the comments if you've implemented a system like this!

映射这样的系统的功能非常简单。 设置这些类型的系统的是出色的样式。 如果您已经实现了这样的系统,请在评论中发布!

翻译自:

mootools 选项卡

转载地址:http://mzpwd.baihongyu.com/

你可能感兴趣的文章
vue.js实现移动端长按事件,处理长按事件和click事件冲突,长按安卓机支持震动...
查看>>
个人开发—进度记录(十一)
查看>>
java中JVM的原理
查看>>
php这是一个随机打印输出字符串的例子
查看>>
前端的图片压缩image-compressor(可在图片上传前实现图片压缩)
查看>>
20165309 实验四 Android程序设计
查看>>
团队博客目录
查看>>
linux的启动流程
查看>>
摩尔斯电码(Morse Code)Csharp实现
查看>>
C#NULL条件运算符
查看>>
使用GZIP压缩网页内容(一)
查看>>
《深入浅出MFC》第二章 C++的重要性质
查看>>
关于智能硬件设备shell安全设计
查看>>
homework1
查看>>
3选择结构程序设计
查看>>
Python学习 12day__高级语法
查看>>
关于做产品的一点思考
查看>>
超大地形的处理 (Terrain Visualization)【转自知乎】
查看>>
html知识2
查看>>
Python—面向对象01
查看>>