.slick-slider {
visibility: hidden;
}
$(document).ready(function() {
$('.slider').on('init', function(event, slick) {
$('.slick-slider').css('visibility', 'visible');
}).slick({
autoplay: true,
});
});
jQuery 2025.4.2
.slick-slider {
visibility: hidden;
}
$(document).ready(function() {
$('.slider').on('init', function(event, slick) {
$('.slick-slider').css('visibility', 'visible');
}).slick({
autoplay: true,
});
});
<section class="scroll">
<div class="first">
テキスト1 テキスト2 テキスト3 テキスト4 テキスト5
</div>
<div class="last">
テキスト1 テキスト2 テキスト3 テキスト4 テキスト5
</div>
</section>
.scroll {
display: flex;
overflow: hidden;
}
.scroll .first,
.scroll .last {
flex-shrink: 0;
width: auto;
height: auto;
display: inline-block;
text-wrap: nowrap;
white-space: nowrap;
}
.scroll .first {
animation: ani-first 10s infinite linear 0.1s both;
}
.scroll .last {
animation: ani-last 10s infinite linear 0.1s both;
}
@keyframes ani-first {
0% {
transform: translateX(0%);
}
100% {
transform: translateX(-100%);
}
}
@keyframes ani-last {
0% {
transform: translateX(0%);
}
100% {
transform: translateX(-100%);
}
}
jQuery 2024.3.27
遷移先ページへ以下を記述する
$(window).load(function () {
var lochref = window.location.href;
if (lochref.indexOf("#") > -1) {
var anchor = lochref.slice(lochref.indexOf("#"));
window.setTimeout(function () {
$("body, html").animate(
{
scrollTop: $(anchor).offset().top,
},
1
);
}, 1);
}
});
WordPress 2024.3.19
これまでは、
<?php the_field('field_name'); ?>
これからは
<?php echo get_field('field_name'); ?>
jQuery 2024.3.13
/* ===============================================
# faq
=============================================== */
jQuery(function ($) {
$(".question").on("click", function () {
/*クリックでコンテンツを開閉*/
$(this).next().slideToggle(200);
/*矢印の向きを変更*/
$(this).toggleClass("open", 200);
});
});
/* ===============================================
# faq 排他処理
=============================================== */
$(function() {
$('.question').click(function() {
$(this).toggleClass('open');
$(this).next().slideToggle();
$('.question').not($(this)).next().slideUp();
$('.question').not($(this)).removeClass('open');
});
});
WordPress 2024.3.5
functions.phpに以下を追加する
add_filter( 'wp_kses_allowed_html', 'acf_add_allowed_iframe_tag', 10, 2 );
function acf_add_allowed_iframe_tag( $tags, $context ) {
if ( $context === 'acf' ) {
$tags['iframe'] = array(
'src' => true,
'height' => true,
'width' => true,
'frameborder' => true,
'allowfullscreen' => true,
);
}
return $tags;
}
<?php
$acfgroup = get_field('group');
$judge = array_filter($acfgroup);
if(!empty($judge)):
endif;
?>
<script>
$(document).ready(function () {
$('form').attr('action', function (i, val) {
return val + '#section';
});
});
</script>
WordPress 2023.11.6
<?php wp_head(); ?> 下に入れる
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
jQuery 2023.10.29
$(window).scroll(function() {
var height = $(window).height();
if ($(window).scrollTop() > height) {
$('header').addClass('is-show');
} else {
$('header').removeClass('is-show');
}
});