有没有办法使用Chrome开发工具测试不同的图像?我创建了一个新的背景图形,我想在一个已经在<body>标签上有背景图形的实际网站上进行测试.不过,我不想改变现场网站.只需测试它,看看新图像是什么样的.这可能吗?
我在我的网站上实现了CSS Tricks Smooth Page Scroll,它运行得非常好.但是,因为我在页面顶部有一个固定的导航栏,当页面滚动到相应的锚点div时,div的顶部会消失在导航栏后面.如何偏移滚动(约70px)以显示整个div?我试过这样做:
var targetOffset = $target.offset().top - 70;
Run Code Online (Sandbox Code Playgroud)
但这并不是很有效.页面滚动到适当的位置,然后它立即跳回来,以便隐藏div的顶部.我错过了什么?这是完整的代码:
$(function() {
function filterPath(string) {
return string
.replace(/^\//,'')
.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
.replace(/\/$/,'');
}
var locationPath = filterPath(location.pathname);
var scrollElem = scrollableElement('html', 'body');
// Any links with hash tags in them (can't do ^= because of fully qualified URL potential)
$('a[href*=#]').each(function() {
// Ensure it's a same-page link
var thisPath = filterPath(this.pathname) || locationPath;
if ( locationPath == thisPath
&& (location.hostname == this.hostname || !this.hostname)
&& this.hash.replace(/#/,'') …Run Code Online (Sandbox Code Playgroud) 我正在使用Foundation构建一个站点,并且我安装了FontAwesome图标.我正在尝试设置一个表单,用户可以单击输入或按钮来查看jQuery日期选择器.我希望能够使用按钮中的FontAwesome图标.但我似乎无法触发按钮来触发日期选择器.
编辑:
我有点工作,但我仍然无法弄清楚如何实现FontAwesome图标.我的HTML中有这个:
<div class="row">
<div class="large-3 columns">
<label>Departure Date</label>
<div class="row date collapse">
<div class="small-9 columns"><input class="small-9 columns" placeholder="Choose Date" type="text" name="date" id="date"></div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这在我的JS中:
$(function() {
$( "#date" ).datepicker({
showOn: "both",
buttonImage: "http://jqueryui.com/resources/demos/datepicker/images/calendar.gif",
buttonText: "THIS IS A BUTTON",
buttonImageOnly: true
});
});
Run Code Online (Sandbox Code Playgroud)
我在哪里放图标?我能以某种方式把它放在buttonText争论中吗?
javascript jquery-ui datepicker jquery-ui-datepicker font-awesome
我正在尝试找出如何将Icomoon字体合并到我的网站中,但无法加载字体。我下载了这些文件并将它们复制到我的 /fonts 目录中。然后我按照此处的说明将 icomoon/fonts 中的文件复制到 /fonts。我将 icomoon/style.css 编辑为:
@font-face {
font-family: 'icomoon';
src:url('../fonts/icomoon.eot');
src:url('../fonts/icomoon.eot?#iefix') format('embedded-opentype'),
url('../fonts/icomoon.woff') format('woff'),
url('../fonts/icomoon.ttf') format('truetype'),
url('../fonts/icomoon.svg') format('svg');
font-weight: normal;
font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)
我将其包含在我的 style.scss "@import "../fonts/icomoon/style.css";" 中。在我的其中一个页面上,我尝试包含一个图标,但它没有显示。我究竟做错了什么?
我正在使用wp_trim_words修剪我主页上的一些摘录.它工作正常,除了它从摘录中剥离HTML标签.我需要能够制作一些大胆的摘录(使用<strong>).按照这里的说明,我尝试删除wp_trim_words函数并使用以下代码将其替换为新函数,该$text = wp_strip_all_tags( $text );函数替换为原始WP函数$text = strip_tags($text, '<strong>',);.但这打破了网站.我究竟做错了什么?
// Remove Reverie Trim Words
function remove_trim_words() {
remove_filter('get_the_excerpt', 'wp_trim_words');
add_filter('get_the_excerpt', 'oakwood_trim_words');
}
// Replace Reverie Trim Words
function oakwood_trim_words( $text, $num_words = 55, $more = null ) {
if ( null === $more )
$more = __( '…' );
$original_text = $text;
$text = strip_tags($text, '<strong>',);
/* translators: If your word count is based on single characters (East Asian characters),
enter 'characters'. Otherwise, …Run Code Online (Sandbox Code Playgroud)