博客
关于我
强烈建议你试试无所不能的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/

你可能感兴趣的文章
sql 入门经典(第五版) Ryan Stephens 学习笔记  第四部分:建立复杂的数据库查询/...
查看>>
[原创]Keys的基本操作总结,判断Keys中是否存在Keys.Control|Keys.Alt,移除Keys中的部分键值。...
查看>>
主题样式之背景图片不随鼠标滑动而移动
查看>>
Centos 中文乱码
查看>>
IDLE常用快捷键
查看>>
MyBatis课程4
查看>>
Git使用笔记
查看>>
Java概述
查看>>
Python数据分析与展示第0&1周学习笔记(北理工 嵩天)
查看>>
log4cplus使用
查看>>
[git]rebase和merge
查看>>
java动态代理
查看>>
Selector的2种样式
查看>>
Mac 卸载mysql
查看>>
php-fpm用socket连接
查看>>
.net core跨域传递cookie
查看>>
SpringMVC <mvc:view-controller path=""/>标签
查看>>
adobe flash player升级coredump分析
查看>>
pycharm快捷键、经常使用设置、配置管理
查看>>
element-ui table 最后一行合计,单元格合并
查看>>