Highlight an individual word within a text block on hover

In javascript/jQuery, is there a way to identify a word in a text block/paragraph? For example, say I have the following paragraph: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris suscipit interdum fermentum. Aenean fermentum imperdiet augue, et venenatis lectus semper vel. Phasellus faucibus nulla in quam egestas eleifend. Cras tristique augue eget libero tristique condime

悬停时突出显示文本块中的单个单词

在JavaScript / jQuery中,有没有一种方法可以识别文本块/段落中的单词? 例如,假设我有以下段落: Lorem ipsum dolor坐在amet,consectetur adipiscing elit。 Mauris怀疑Interdum fermentum。 Aenean fermentum imperdiet augue,et venenatis lectus semper vel。 在quam egestas eleifend中的Phasellus faucibus nulla。 Cras tristique augue eget libero tristique condimentum。 Mauris eget diam eget risus fe

Slider FileReader JS Multiple Image Upload (Incrementing Index)

I am trying to make a JavaScript multiple image uploader that uploads image previews to a slider, but I am having some issues. So far it looks like I was able to get the images to upload into the slider, but the problem seems to happen with my i variable - when I try to increment it, it stays the same, not allowing my next and previous slider arrows from working. If anyone knows how to get this

Slider FileReader JS多图像上传(增量索引)

我正在尝试制作一个将图片预览上传到滑块的JavaScript多图片上传器,但我遇到了一些问题。 到目前为止,它看起来像我能得到的图像上传到拉头,但这个问题似乎与我发生i的变量-当我试图增加它,它保持不变,不会让我的next和previous滑块箭头从加工。 如果有人知道如何让这个滑块正常工作,我将不胜感激。 JS代码: $('#_uploadImages').click(function() { $('#_imagesInput').click() }) $('#_imagesInput').on('chang

Get mouse position within div?

Possible Duplicate: Mouse position relative to div getting mouse position with javascript within canvas How can I get the position of the mouse within a canvas that is a fixed size but has an automatic margin? I can't make its position fixed and can't just use the regular mouse position on the page. This code works perfectly: mouseX = e.pageX - div.offsetLeft; mouseY = e.pageY

在div中获取鼠标位置?

可能重复: 鼠标相对于div的位置 在canvas中获取鼠标位置 如何在具有固定尺寸但具有自动边距的画布内获取鼠标的位置? 我无法修正它的位置,也不能只使用页面上的常规鼠标位置。 此代码完美工作: mouseX = e.pageX - div.offsetLeft; mouseY = e.pageY - div.offsetTop; 使用jQuery: var divPos = {}; var offset = $("#divid").offset(); $(document).mousemove(function(e){ divPos = { left: e.pageX

Webpack build very slow because of external libraries

I try use webpack to my app, but it build my app for 60-100sec each time. How can i disable rebuild files from node_modules/* and bower_components/* or build them for separate chunk (per module or shared). here is part of config: { test: /.js$/, exclude: /(node_modules|bower_components)/, loaders: ['ng-annotate', 'babel-loader'] }, and resolve: { moduleDirectories: ['node_

由于外部库,Webpack构建速度很慢

我尝试将webpack用于我的应用程序,但它每次构建我的应用程序60-100秒。 我该如何禁用从node_modules/*和bower_components/*重建文件或将它们构建为单独的块(每个模块或共享)。 这里是config的一部分: { test: /.js$/, exclude: /(node_modules|bower_components)/, loaders: ['ng-annotate', 'babel-loader'] }, 和 resolve: { moduleDirectories: ['node_modules', 'bower_components'] }, 如何通

Configuring a dark theme for Angular Material

I'm working on a design for my webapp, and I'd like a dark theme similar to that seen here. Sadly I've found the Angular Material Theming Docs very hard to get my head around; no mention of where each colour will be used, how to set a background color or a text color etc. I'm currently using: .config(function($mdThemingProvider) { $mdThemingProvider.definePalette('coolpa

配置角度材质的黑暗主题

我正在为我的webapp设计一个设计,并且我想要一个类似于这里看到的黑暗主题。 可悲的是,我发现角度材料理论文档非常难以理解; 没有提及每种颜色的使用位置,如何设置背景颜色或文字颜色等。 我目前正在使用: .config(function($mdThemingProvider) { $mdThemingProvider.definePalette('coolpal', {"50":"#d9ddec","100":"#a6b1d2","200":"#8190bf","300":"#5468a5","400":"#495b90","500":"#252830","600":"#354168"

Forcing IE8 to rerender/repaint :before/:after pseudo elements

so I've been toying with this calendar-ish thingy for a bit: Grid of divs (mimicking a table) Hovering over a table cell displays a tooltip with 2 icons each consisting of a div with :before and :after elements Icons change colour depending on colour of cell hovered and that of its previous sibling (cell's colour class is applied to the icon). Stripped down fiddle: http://jsfiddle

强制IE8重新渲染/重新绘制:之前/:在伪元素之后

所以我一直在玩这个日历, div格子(模仿一张桌子) 将鼠标悬停在表格单元格上会显示一个包含2个图标的工具提示,每个图标都包含div:before和after元素 图标会根据徘徊的单元格颜色和其以前的同级单元格颜色(单元格的颜色类别应用于图标)更改颜色。 剥离小提琴:http://jsfiddle.net/e9PkA/1/ 这在每个浏览器中都能正常工作,但IE8及以下版本(IE lte 7和我绝不会是朋友,但IE8会很高兴)。 IE8注意到classNames

Gulp, using current filename in `pipe()` function

I'm trying to render each file in my gulp source files with it's own json file, but I can't figure out how to access the current filename in the pipe function. var gulp = require('gulp'); var handlebars = require('handlebars'); var gulpHandlebars = require('gulp-compile-handlebars'); gulp.task('compile-with-sample-data', function () { var options = {} return gulp.src('./src/**/*

gulp,在`pipe()`函数中使用当前文件名

我试图使用它自己的json文件渲染我的gulp源文件中的每个文件,但我无法弄清楚如何访问pipe函数中的当前文件名。 var gulp = require('gulp'); var handlebars = require('handlebars'); var gulpHandlebars = require('gulp-compile-handlebars'); gulp.task('compile-with-sample-data', function () { var options = {} return gulp.src('./src/**/*.html') .pipe(gulpHandlebars({ data: require('./data/' + filena

Using Google Maps offline (Js Api)

I'm trying to make an NodeJs App in which, on web page I'm using Maps, For some reasons I've chosen Google Maps and I want to stick to it. My question is, Is there anyway where I can either store or cache map tiles offline and later on use it as needed [Note: Not looking for any hack or Illegal way for it, I already know there are many such ways]. I tried and saw many options like

离线使用Google地图(Js Api)

我试图制作一个NodeJs应用程序,其中,在我使用地图的网页上,出于某些原因,我选择了Google地图,并且我想坚持使用它。 我的问题是,无论如何,我可以将地图图块存储或缓存为离线地图,稍后根据需要使用它[注意:不会查找任何黑客或非法的方式,我已经知道有很多这样的方式]。 我试过并看到许多选择,例如GEE(Google地球企业版)便携式,但我想他们很快就会关闭它,即到2017年。 基本上我在这里尝试的是尽量减少渲染地图

Responsive Grid Layout Framework

I want an easy to use grid framework for my current web project. These are the features i would appreciate: fluid grid layout : boxes that can be aligned horizontally (side by side), each having the same height (for example a 3-column layout), working with 100% width responsiveness : adapts automatically when resizing the browser window mobile devices : shows an alternate fitting layout fo

响应式网格布局框架

我想为我当前的Web项目使用一个简单的网格框架。 这些是我会欣赏的功能: 流体网格布局 :可水平排列(并排)的盒子,每个盒子具有相同的高度(例如3列布局),工作宽度为100% 响应能力 :调整浏览器窗口大小时自动适应 移动设备 :显示垫和手机的替代贴合布局 文字大小 :可选择动态调整文字大小(例如全宽标题) 图像大小 :可选择动态调整图像大小(例如全宽图像库) 断点 :可选择定义触发事件的宽度值,这会

case mapping from "data

If you put a "data-" attribute on an element: <div id='x' data-key='value'> then you can get the value via the jQuery ".data()" method: alert($('#x').data('key')); // alerts "value" The library uses a consistent camel-case converter for attribute names with embedded dashes: <div id='x' data-hello-world="hi"> alert($('#x').data("helloWorld")); The camel-case

来自“数据”的案例映射

如果你在一个元素上放置一个“data-”属性: <div id='x' data-key='value'> 那么你可以通过jQuery“.data()”方法获得值: alert($('#x').data('key')); // alerts "value" 该库为具有嵌入破折号的属性名称使用一致的骆驼大小写转换器: <div id='x' data-hello-world="hi"> alert($('#x').data("helloWorld")); 骆驼大小写转换器是一个jQuery“全局”函数: alert($.camelCase("hello-world")); // alerts "hel