所以我使用了一个非常基本的jQuery .slideDown,它在FF,Safari和Chrome中运行良好.在IE7中根本不起作用.这是脚本:
//Top Mailing List Drop down animation
$(document).ready(function() {
$('div#top_mailing_hidden').hide();
// Expand Panel
$("input#top_mailing").focus(function(){
$("div#top_mailing_hidden").slideDown("slow");
});
// Collapse Panel
$("input#top_mailing").blur(function(){
$("div#top_mailing_hidden").slideUp("slow");
});
});
Run Code Online (Sandbox Code Playgroud)
我已经研究了几个小时,发现了一些与滑动/缩小有关的错误,导致它在用于postion的后代时在IE7中失败:固定元素.这个动画发生在一个位置:固定的导航栏,但是,我已经尝试用位置包装内部元素:相对但无济于事,我仍然在IE中得不到任何东西.另外,请注意nav元素是用jQuery隐藏的,即使在IE7中该函数也能正常工作,但是,滑动/缩小不是.
这是相关的CSS:
/* --------------Top Dropdown Mailing List------------------- */
#top_nav div#top_mailing{
float: right;
width: 351px;
padding: 0 10px 10px 5px;
background: url(images/top_mailing_bg.png) bottom center no-repeat;
position: absolute;
top: 0;
right: 0;
color: #fff;
text-shadow:0 -1px 0px #222;
}
#top_mailing #top_mailing_hidden{
font-size: .7em;
text-align: center;
position: relative;
height: 30px;
zoom: 1;
}
#top_mailing #top_mailing_hidden div{
}
#top_mailing #top_mailing_hidden …Run Code Online (Sandbox Code Playgroud) 我正在使用新的CSS3规范"background-size"来使背景图像略微溢出页面大小.它在webkit(Chrome和Safari)中运行良好,但"-moz-background-size"属性在Firefox中根本不起作用.不寻常的是,如果您浏览的网站直播,将"-moz-背景大小的"属性IS观看Firebug的网站的时候露出来了!FF文档表示从3.6开始支持它,我运行3.6.
这是我的代码:
@media screen and (max-width: 1150px) {
/* special sytles for browser windows less than 1150px */
body{
-o-background-size: 130%; -webkit-background-size: 130%; -khtml-background-size: 130%; -moz-background-size: 130%;
background-size: 130%;
}
#trans_fake{
-o-background-size: 130%; -webkit-background-size: 130%; -khtml-background-size: 130%; -moz-background-size: 130%;
background-size: 130%;
}
}
Run Code Online (Sandbox Code Playgroud)
任何调试建议?
编辑 我现在更困惑了... QuirksMode.org报告了一个"白色"框而不是红色或绿色表示在Firefox 3.6中基于css3背景大小百分比的兼容性:( http://www.quirksmode.org/ CSS/background.html
这里真正简单的问题 - 如何将Brian Cherne 的.hoverIntent插件添加到以下代码中代替.live("hover", function
$(".highlight").live("hover", function(){
$(this).animate({"width": "454px", "height":"282px", "top: ":"94px", "left":"152px", "margin-top: ":"-94px", "margin-left":"-152px"}, 500);
});
Run Code Online (Sandbox Code Playgroud)
这是完整的代码:
$(document).ready(function(){
$('#sliding_grid li').hover(function() {
$(this).css('z-index',1).data('origTop',$(this).css('top')).data('origLeft',$(this).css('left')).addClass('highlight');
}, function() {
$(this).css('z-index', 0);
});
$(".highlight").live("hover", function(){
$(this).animate({"width": "454px", "height":"282px", "top: ":"94px", "left":"152px", "margin-top: ":"0", "margin-left":"0"}, 500);
});
$(".highlight").live("mouseout", function(){
$(this).animate({"width": "148px", "height":"90px", "top: ":$(this).data('origTop'), "left":$(this).data('origLeft'), "margin-top: ":"0", "margin-left":"0"}, 500, function(){
$(this).removeClass('highlight');
});
});
});
Run Code Online (Sandbox Code Playgroud) 因此,如果您还不熟悉,CSS3过渡不会生成动画,display: none因为它会完全从DOM中删除目标元素.所以这是我的问题.我有一个带有较大弹出窗口的侧边栏,显示在悬停状态.不幸的是因为我只能在过渡visibility: hidden和opacity: 0我有反弹时,由于被包括在布局中明显隐藏层,从而使得其在页面的滚动条占了一个很长的弹出窗口.
寻找一些创造性的解决方案,我仍然可以动画,而不必将滚动条搞砸.
我正在开发本地,所以我没有显示的实例,但你可以在这个截屏视频中看到问题:http://dreamstarstudios.com/screencasts/2011-09-27_2111.swf
提前致谢!
我已经浏览了一些类似的问题 - 但我一直在寻找,并且没有运气找到与我正在寻找的实现相同的实现.
这非常简单:
<a class="contacttoggle" href="#">Contact</a>
<div>Lots of content between</div>
<div>Lots of content between</div>
<div>Lots of content between</div>
<div>Lots of content between</div>
<div class="contact_box">Contact info that is initially hidden and then fades in when the "contact_toggle" Contact link above is clicked</div>
Run Code Online (Sandbox Code Playgroud)
我正在寻找这个淡入淡出它将绝对定位在页面上(不用担心我可以处理CSS).我只是不想要幻灯片效果.刚刚淡入.
我觉得这个代码应该工作,但它不是:(
$(document).ready(function(){
/* function to show and hide main navigation conatct box */
$(".contact_box").hide();
$('a.contacttoggle').click(function() {
$(this).next("div").find(".contact_box").toggle(400);
return false;
});
})
Run Code Online (Sandbox Code Playgroud) 我正在研究一个项目并使用Ariel Flesler的jquery.scrollTo.js和jquery.localScroll.js ...我有本地链接滚动到页面上的各种div.
我遇到的麻烦是我在页面顶部有一个固定位置的导航栏,而ScrollTo正在计算窗口位置(正确)而没有考虑到它.下面是scrollTo.js文件...有人可以告诉我在哪里以及如何我会插入会导致Y轴滚动位置为+ [Y] px的代码?
/**
* jQuery.ScrollTo - Easy element scrolling using jQuery.
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 3/9/2009
* @author Ariel Flesler
* @version 1.4.1
*
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
*/
;(function($){var m=$.scrollTo=function(b,h,f){$(window).scrollTo(b,h,f)};m.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1};m.window=function(b){return $(window).scrollable()};$.fn.scrollable=function(){return this.map(function(){var b=this,h=!b.nodeName||$.inArray(b.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!h)return b;var f=(b.contentWindow||b).document||b.ownerDocument||b;return $.browser.safari||f.compatMode=='BackCompat'?f.body:f.documentElement})};$.fn.scrollTo=function(l,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};if(l=='max')l=9e9;a=$.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=$(k),d=l,p,g={},q=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px)?$/.test(d)){d=n(d);break}d=$(d,this);case'object':if(d.is||d.style)p=(d=$(d)).offset()}$.each(a.axis.split(''),function(b,h){var f=h=='x'?'Left':'Top',i=f.toLowerCase(),c='scroll'+f,r=k[c],s=h=='x'?'Width':'Height';if(p){g[c]=p[i]+(q?0:r-o.offset()[i]);if(a.margin){g[c]-=parseInt(d.css('margin'+f))||0;g[c]-=parseInt(d.css('border'+f+'Width'))||0}g[c]+=a.offset[i]||0;if(a.over[i])g[c]+=d[s.toLowerCase()]()*a.over[i]}else g[c]=d[i];if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],u(s));if(!b&&a.queue){if(r!=g[c])t(a.onAfterFirst);delete g[c]}});t(a.onAfter);function t(b){o.animate(g,j,a.easing,b&&function(){b.call(this,l,a)})};function u(b){var h='scroll'+b;if(!q)return k[h];var f='client'+b,i=k.ownerDocument.documentElement,c=k.ownerDocument.body;return Math.max(i[h],c[h])-Math.min(i[f],c[f])}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);
/**
* jQuery.LocalScroll - Animated scrolling navigation, using anchors. …Run Code Online (Sandbox Code Playgroud) 处理一个高度复杂的WordPress主题,该主题具有许多不同的自定义帖子类型.我的印象是下面的代码会检查当前帖子是否属于"philosopher"类型,然后只有当帖子属于该类型时才运行PHP条件:
<?php if (get_post_type() == 'philosopher') { ?>
Run Code Online (Sandbox Code Playgroud)
不幸的是,我的期望是为了使"philosopher","text"和"original"的条件相同,我的代码应如下所示:
<?php if (get_post_type() == 'philosopher','text','original') { ?>
Run Code Online (Sandbox Code Playgroud)
但是,唉,我错了.我确实得到了以下代码,但我想知道是否有更简洁的方法来做到这一点(或者如果我在某种程度上遗漏了某些东西)
<?php if ( (get_post_type() == 'philosimply') || (get_post_type() == 'text') || (get_post_type() == 'original')) { ?>
Run Code Online (Sandbox Code Playgroud) 我正在寻找与“ a”,“ p”,“ a”,“ p”,“ am”,“ pm”,“ am”,“ pm”匹配的正则表达式。
请注意,我要查找的是与空格无关的。我在一个字符串中有一个正则表达式分组,我现在所拥有的对a / m / am / pm不起作用是这样的:
/^(\d{1,2}):(\d{2})(\s(am|pm|a|p)$)/i;
很抱歉没有提供更多详细信息,但有任何人在superfish.js和WordPress插件" 联系表单7 " 之间遇到javascript冲突吗?
基本上,我已经经历了大量的调试,并在那里找到了保证的冲突,网站上的其他一切都很棒.
我应该在我的页面上的其他地方初始化superfish.js,因为我无法控制WordPress标头初始化联系表单7的位置吗?
编辑:忘了提到冲突的性质 - 当两个脚本都处于活动状态时,超级鱼子ul将不会显示
在下面的代码中,$ start是手动输入到datepicker的开始日期,$ end也是一个单独的键,通过datepicker输入.这些与今天的日期('ymd')进行了比较.
在这个插件的代码的早期,我们有这个代码(其中相同的参数返回true):
//Parse End Date
if($end):
$end = explode('-', $end);
$end = mktime($hour, $_POST['_date_minute'], 0, $end[0], $end[1], $end[2]);
if ((date('ymd',$start) < date('ymd',$end)) && (date('ymd',$end) >= date('ymd'))) {
$compare = date('ymd'); //Overwrite start date $compare
}
else {
$compare = date('ymd', $start);
}
endif;
Run Code Online (Sandbox Code Playgroud)
稍后在代码中,相同的参数在此处返回false:
function event_list_date($start_or_end, $format, $echo = true){
global $post;
// Check the end date, if it's greater than today and then start date is less than or equal to today, round it off so that …Run Code Online (Sandbox Code Playgroud) 将正则表达式的开头和结尾定义word为捕获组中的边界的正确语法是什么,如下所示:
var $classes = $( 'body' ).attr('class'); // string 'foo bar sub-theme-home';
var regex = /sub-theme-(?=(\b))/;
var sub_theme = regex.exec($classes);
console.log(sub_theme[0]);
Run Code Online (Sandbox Code Playgroud)
这是匹配的sub-theme-,虽然我需要在我的捕获中包含它并进行字符串替换以删除它,但我很难找到我的(?-(\b))/捕获组的正确语法.似乎有积极的前瞻,sub-theme-应该是被忽略的部分,home应该被捕获...帮助?
我不知道如何做到这一事实是我的PHP技能基本程度的一个很好的例子.
如何将字符串缩短$fr_month为3个字符作为函数" short_fr_month()"?
为看似显而易见的问题道歉,但我认为答案可能会对其他人有所帮助。我一辈子都找不到Google App Engine VM(Cloud Shell)内文件路径上的文档,从中可以找到要从中提供服务的静态文件。我需要从私有github存储库中获取最新的上游更改。
请注意,我在VM的其他位置导航,甚至重新启动会话也没有使我进入VM内的默认项目根路径,正如我期望的那样。