我正在尝试突出显示页面其余部分的div/grey.我的代码是:
jQuery(document).ready(function ($) {
$('.entry-content').mouseover(function(e) {
$('.expose').mouseover(function(e){
$(this).css('z-index','99999');
$('#overlay').fadeIn(300);
});
});
$('.entry-content').mouseleave(function(e) {
$('.expose').mouseleave(function(e){
$('#overlay').fadeOut(0, function(){
$('.expose').css('z-index','1');
});});});});
Run Code Online (Sandbox Code Playgroud)
HTML看起来像
<div id="overlay">
<div class="entry-content">
<div class="expose">something</div>
<div class="expose">something</div>
<div class="expose">something</div>
</div>
#overlay {
background:rgba(0,0,0,0.3);
display:none;
width:100%; height:100%;
position:absolute; top:0; left:0; z-index:99998;
}
Run Code Online (Sandbox Code Playgroud)
我所追求的是只要用户在入口内容div上盘旋,让页面变灰并突出显示他正在盘旋的div.
有任何想法吗?谢谢
我正在尝试使用Typeahead.js设置自定义模板
我的代码是:
var countries = new Bloodhound({
datumTokenizer: function(d) {
return Bloodhound.tokenizers.whitespace(d.value);
},queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 100,
remote: {
url: 'http://www.domain.com/json.php?action=countries&q=%QUERY'
}
});
countries.initialize();
$('.lang').typeahead(null, {
name: 'countries',
source: countries.ttAdapter(),
template: [
'<p class="lang-id">{{lang_id}}</p>',
'<p class="value">{{value}}</p>'
].join(''),
engine: Hogan
});
Run Code Online (Sandbox Code Playgroud)
它工作正常,但模板设置被忽略 - 我仍然得到默认下拉列表.我究竟做错了什么?
编辑:我也尝试过:
$('input').typeahead(null, {
name: 'countries',
displayKey: 'value',
source: countries.ttAdapter(),
templates: {
empty: [
'<div class="empty-message">',
'no results found',
'</div>'
].join('\n'),
suggestion: '<p><strong>{{value}}</strong> – {{id}}</p>'
},
engine: Hogan
});
Run Code Online (Sandbox Code Playgroud)
这会引发错误:
Property 'suggestion' of object #<Object> is not a function
我正在使用blueimp文件上传插件上传文件.有一个示例正则表达式只限制上传到图像:
var acceptFileTypes = /^image\/(gif|jpe?g|png)$/i;
Run Code Online (Sandbox Code Playgroud)
如何更改此内容以上传图像文件以及PDF,TXT,DOC等文档?
点击按钮,我正在添加一个CSS <head>:
$("head").append("<link id='#color_1_css' href='" + newCssHref +"' type='text/css' rel='stylesheet' />");
Run Code Online (Sandbox Code Playgroud)
这增加了<head>:
<link id="#color_1_css" rel="stylesheet" type="text/css" href="http://domain.com/styles/colors/f69548/f69548.css">
Run Code Online (Sandbox Code Playgroud)
在另一个按钮单击我需要再次删除它.我尝试了以下内容,但由于某种原因无效:
$('html').on('click', '.clear-color-picker', function(events){
var id = $(this).attr('data-parentID').replace('background_color','');
$('#' + $(this).attr('data-parentID')).setColor('');
$('#' + id).css('background-color','');
if (id == 'main-color') {
console.log('clicked');
$('#color_1_css').remove();
}
})
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我有以下div:
<div class="mydiv">
This is some introduction text
<br />
click me
</div>
Run Code Online (Sandbox Code Playgroud)
是否可以click me仅使用CSS设置与div其余部分不同的样式?
我的页面上有许多第三方JS脚本。当我加载页面时,它会向下滚动到特定的div。
我已经花了两个小时试图找出导致滚动的代码。
有没有办法找出哪个脚本/部分代码触发了滚动?
我试图让HTML头两个样式注释标记之间的内容,/*color_1*/和/*color_1_end*/.我试过了:
var html = '/*color_1*/.welcome p, .intro p { color: #75735d;}/*color_1_end*/';
var testRE = html.match(/\/*color_1*\/(.*?)\/*color_1_end*\//i);
console.log(testRE);
Run Code Online (Sandbox Code Playgroud)
但我想我有逃避错误,或完全错误的正则表达式错误.如何使用Javascript获取这些标签之间的内容?
我正在使用jQuery文件上传,我的代码是:
$(function(){
var ul = $('#upload ul');
// Initialize the jQuery File Upload plugin
$('#upload').fileupload({
maxFileSize: 500,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
formData: {
action: 'ja_upload_doc',
cv_id: $('#cv_id').val(),
first_name: $('#first_name').val(),
last_name: $('#last_name').val(),
},
// This element will accept file drag/drop uploading
dropZone: $('#drop'),
// This function is called when a file is added to the queue;
// either via the browse button, or via drag/drop:
add: function (e, data) {
// Automatically upload the file once it is added to the queue
var …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的应用程序中实现Metronic管理主题,但是当我点击一个按钮时,我得到Empty string passed to getElementById().了按钮不起作用.
我正在尝试跟踪哪一段代码触发此错误.我怎样才能找出问题所在?
javascript ×5
jquery ×4
css ×2
css3 ×2
debugging ×2
html ×2
regex ×2
blueimp ×1
fadeout ×1
file-upload ×1
html-head ×1
typeahead.js ×1