Javascript 我需要改变这个Wordpress幻灯片插件的分页方式,将其显示为数字而不是图像
我有一个Wordpress插件(名为Slideshow,Find),在ul()中显示为项目符号的幻灯片上方有分页 我需要的是它显示为以下格式的数字:“图片1/15”。我是javascript新手,很难让它做到这一点。我能够识别(至少我认为我是)需要为此修改的代码部分 PHP():Javascript 我需要改变这个Wordpress幻灯片插件的分页方式,将其显示为数字而不是图像,javascript,php,html,wordpress,Javascript,Php,Html,Wordpress,我有一个Wordpress插件(名为Slideshow,Find),在ul()中显示为项目符号的幻灯片上方有分页 我需要的是它显示为以下格式的数字:“图片1/15”。我是javascript新手,很难让它做到这一点。我能够识别(至少我认为我是)需要为此修改的代码部分 PHP(): 我们可以添加CSS和jQuery来隐藏和修改滑块的输出。这是纯粹的额外代码,不涉及原始代码。可以在functions.php上使用,或者更好地在应用程序上使用 通过CSS,我们隐藏了一些东西: # Required:
我们可以添加CSS和jQuery来隐藏和修改滑块的输出。这是纯粹的额外代码,不涉及原始代码。可以在functions.php
上使用,或者更好地在应用程序上使用
通过CSS,我们隐藏了一些东西:
# Required: PHP 5.3
# See Lambda functions: https://stackoverflow.com/q/1909002/1287812
add_action( 'wp_head', function() {
?>
<style>
.slideshow_container_style-light .slideshow_pagination ul li {
background: none !important; /* was the bullet img */
}
span.assistive-text.hide-text { /* unhide text */
display: block !important;
font:15px arial,sans-serif;
position: initial !important;
text-shadow: #000 1px 1px 1px;
color:#fff;
}
</style>
<?php
});
#必需:PHP5.3
#参见Lambda函数:https://stackoverflow.com/q/1909002/1287812
添加行动('wp_head',函数(){
?>
.slideshow_container_style-light.slideshow_分页ul li{
背景:无!重要;/*子弹是img吗*/
}
span.assistive-text.hide-text{/*取消隐藏文本*/
显示:块!重要;
字体:15px arial,无衬线;
位置:初始!重要;
文本阴影:#000 1px 1px 1px;
颜色:#fff;
}
jQuery(文档).ready(函数($){
函数启动(){
$(“span.assistive text.hide text”)。每个(函数(){
var text=$(this.text();
text=text.replace(“转到幻灯片”和“”);
$(此).text(文本);
});
}
/*等待幻灯片放映开始启动替换功能*/
var timeoutID=window.setTimeout(启动,1500);
});
当我试图转到你发布的链接时,它转到了404。可能是一些访问控制问题?是的,对不起,我必须找到一个解决方法,因为我没有时间了。它不允许我删除这个问题,因为它有一个公开的悬赏。很好的解决方案(+1)-根据你的档案,我看到你写博客已经有一段时间了;-)天哪!接得好:)
prototype.activatePagination = function () {
if (this.settings.showPagination) {
this.$pagination.find(".slideshow_pagination_center").html("<ul></ul>");
var i = this.$pagination.find("ul");
i.html(""), this.$views.each(t.proxy(function (t) {
var s = "",
e = parseInt(t, 10) + 1,
n = this.$pagination.data("goToText");
("string" != typeof n || n.length <= 0) && (n = this.$pagination.attr("data-go-to-text")), t == this.currentViewID && (s = "slideshow_currentView"), i.append('<li class="slideshow_transparent ' + s + '" data-view-id="' + t + '" role="button" title="' + n + " " + e + '"><span class="assistive-text hide-text">' + n + " " + e + "</span></li>")
}, this)), this.$pagination.find("li").attr("tabindex", "0").click(t.proxy(function (i) {
var s, e = t(i.currentTarget);
this.currentlyAnimating || (s = e.data("viewId"), isNaN(parseInt(s, 10)) && (s = e.attr("data-view-id"), isNaN(parseInt(s, 10))) || (this.pauseAllVideos(), this.playState === this.PlayStates.PLAYING && (this.pause(this.PlayStates.TEMPORARILY_PAUSED), this.play()), this.animateTo(parseInt(s, 10), 0)))
}, this)), this.bindSubmitListener(this.$pagination.find("li")), this.$container.bind("slideshowAnimationStart", t.proxy(function () {
var i = this.$pagination.find("li");
i.each(t.proxy(function (i, s) {
t(s).removeClass("slideshow_currentView")
}, this)), t(i[this.currentViewID]).addClass("slideshow_currentView")
}, this)), this.settings.hidePagination ? (this.$container.mouseenter(t.proxy(function () {
this.$pagination.stop(!0, !0).fadeIn(100)
}, this)), this.$container.mouseleave(t.proxy(function () {
this.$pagination.stop(!0, !0).fadeOut(500)
}, this))) : this.$pagination.show()
}
}, i.Slideshow.prototype.activatePauseOnHover = function () {
this.settings.pauseOnHover && (this.$container.mouseenter(t.proxy(function () {
clearTimeout(this.pauseOnHoverTimer), this.playState !== this.PlayStates.PAUSED && (this.pauseOnHoverTimer = setTimeout(t.proxy(function () {
this.pause(this.PlayStates.TEMPORARILY_PAUSED)
}, this), 500))
}, this)), this.$container.mouseleave(t.proxy(function () {
clearTimeout(this.pauseOnHoverTimer), this.playState !== this.PlayStates.PAUSED && this.interval === !1 && this.play()
}, this)))
}
}();
slideshow_jquery_image_gallery_backend_script_scriptsloadedFlag = !0;
# Required: PHP 5.3
# See Lambda functions: https://stackoverflow.com/q/1909002/1287812
add_action( 'wp_head', function() {
?>
<style>
.slideshow_container_style-light .slideshow_pagination ul li {
background: none !important; /* was the bullet img */
}
span.assistive-text.hide-text { /* unhide text */
display: block !important;
font:15px arial,sans-serif;
position: initial !important;
text-shadow: #000 1px 1px 1px;
color:#fff;
}
</style>
<?php
});
add_action( 'wp_enqueue_scripts', function(){ wp_enqueue_script('jquery'); } );
add_action( 'wp_footer', function() {
?>
<script>
jQuery(document).ready(function($) {
function startUp() {
$("span.assistive-text.hide-text").each(function() {
var text = $(this).text();
text = text.replace("Go to slide", "");
$(this).text(text);
});
}
/* Wait slideshow start to fire the replace function */
var timeoutID = window.setTimeout( startUp, 1500 );
});
</script>
<?php
});