我在网上搜索了很多,但我找不到一个跨浏览器解决方案来淡化css背景图像到灰度和背面.
唯一可行的解决方案是应用CSS3过滤器灰度:
-webkit-filter: grayscale(100%);
Run Code Online (Sandbox Code Playgroud)
但这适用于Chrome v.15 +和Safari v.6 +(你可以在这里看到:http://css3.bradshawenterprises.com/filters/ )
在线的许多页面都谈到了灰色元素的解决方案:
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
filter: gray; /* IE6-9 */
Run Code Online (Sandbox Code Playgroud)
(你可以在这里看到:http://www.karlhorky.com/2012/06/cross-browser-image-grayscale-with-css.html)
但实际上它似乎不适用于CSS背景图像,就像webkit过滤器那样.
是否有任何解决方案(可能使用jquery?)来破解在不太先进的浏览器上缺少对过滤器的支持?
我搜索了很多但我无法弄清楚如何在表单提交之前验证新的reCaptcha,以及jQuery validation插件的验证功能.
我的意思是这样的:
$.validator.addMethod('reCaptchaMethod', function (value, element, param) {
if (grecaptcha.getResponse() == ''){
return false;
} else {
// I would like also to check server side if the recaptcha response is good
return true
}
}, 'You must complete the antispam verification');
$("#form").validate({
rules: {
name: {
required: true,
minlength: 2
},
email: {
required: true,
email: true
},
reCaptcha: {
reCaptchaMethod: true
}
},
messages: {
name: "Please fill your name",
email: "Please use …Run Code Online (Sandbox Code Playgroud) 我刚刚为wp构建了我的第一个插件,即使它不是一个伟大的"代码诗";)它可以正常工作.它是一个使用GalleryView 3.0 jquery插件(http://spaceforaname.com/galleryview)转换默认wp库的插件.
我唯一无法做的就是本地化.此插件的本地化意味着翻译管理界面,其中有人可以配置jquery插件选项以更改结果库的方面.
我试图关注网上出现的数百万篇教程,在论坛上阅读了很多关于这个问题的帖子,并遵循了Codex的指导原则......但仍然没有运气.
这就是我所做的:
__和_e)load_plugin_textdomain在主插件文件中添加该功能.我试过,因为没有办法让它工作.我唯一不确定的事实是我创建的插件不是在类+构造函数之下......只是因为我在编码方面还不是很好.
但我把load_plugin_textdomain里面放了一个init add_action,像这样:
add_action('init', 'gw_load_translation_file');
function gw_load_translation_file() {
// relative path to WP_PLUGIN_DIR where the translation files will sit:
$plugin_path = dirname(plugin_basename( __FILE__ ) .'/languages' );
load_plugin_textdomain( 'gallery-view-for-wordpress', false, $plugin_path );
}
Run Code Online (Sandbox Code Playgroud)
上面的行不在逻辑中,它们只是在主插件文件中,就像那样.
这是我使用gettext函数的一个例子:
<h3><?php _e('Panel Options','gallery-view-for-wordpress') ?></h3>
Run Code Online (Sandbox Code Playgroud)
什么我不明白?
我正在尝试通过wp主题上的ajax在地图上创建标记。经过一番挣扎之后,我发现我无法使用任何php文件通过ajax获取数据,我必须使用admin-ajax.php文件。
根据许多示例,这是我的代码
在functions.php中
add_action( 'wp_enqueue_scripts', 'add_frontend_ajax_javascript_file' );
function add_frontend_ajax_javascript_file()
{
wp_localize_script( 'frontend_ajax', 'frontendajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
wp_enqueue_script( 'ajax_custom_script', get_stylesheet_directory_uri() . '/includes/ajax-javascript.js', array('jquery') );
}
add_action( 'wp_ajax_get_post_information', 'get_post_information' );
add_action( 'wp_ajax_nopriv_get_post_information', 'get_post_information' );
function get_post_information()
{
$get_this= $_GET['this'];
$get_that= $_GET['that'];
...my select...
echo json formatted data
}
Run Code Online (Sandbox Code Playgroud)
js文件已加载并正常工作,它在ajax调用之前做了其他工作,在此行中由于出现错误而停止:
$.post({
url:frontendajax.ajaxurl,
{
action: 'get_post_information',
data: data
},
success: function(response) {
Run Code Online (Sandbox Code Playgroud)
但是我总是有同样的错误:
参考错误:未定义frontendajax.ajaxurl
我的错误在哪里?
PS:我使用get_stylesheet_directory_uri()是因为我处于子主题中。
jquery ×2
php ×2
wordpress ×2
ajax ×1
background ×1
css ×1
frontend ×1
grayscale ×1
image ×1
javascript ×1
localization ×1
plugins ×1
recaptcha ×1
validation ×1