AnythingSlider:使导航选项卡处于非活动状态?
我正在使用 AnythingSlider 工具,但在使用 css 和 js 时遇到了一些问题。基本上,滑块有许多导航选项卡,可帮助从一张幻灯片跳转到另一张幻灯片。我想更改此设置,以便当 Coldfusion 条件运行时,某些选项卡将保持默认状态或变为非活动状态(将选项卡的颜色更改为灰色,当用户单击该选项卡时不会发生任何事情。)
所以基本上,我的 CF会是这样的
<cfif #X# is ""> //if true, make tab #2 not clickable, change color to grey
//else, if false, keep tab normal.
滑块基本上是在html中设置的,如下所示:
<ul>
<li></li> //slide #1
<li></li> //slide #2 etc etc
</ul>
我有一个想法,也许我可以设置一个类li class =“false”作为示例,并且每个“幻灯片”有两个li标签(如果x则显示一个)为真,否则为假。)
所以,我不确定这是否有意义,但大多数情况下,我需要有人来操作 CSS。滑块选项卡的代码如下所示:
div.anythingSlider.activeSlider .thumbNav a.cur, div.anythingSlider.activeSlider .thumbNav a {
background-color: #7C9127;
}
更新 好吧,我不明白。这是我页面末尾的代码(就在结束 BODY 标记之前)。我在那里添加了一些警报,只是为了确保代码运行并且确实运行。但是,什么也没有发生。选项卡不会变得不活动,颜色也不会改变。
我更改了 everythingslider.css 以包含此内容:
div.anythingSlider.activeSlider .thumbNav a.false,
div.anythingSlider.activeSlider .thumbNav a.false:hover { background: #555; }
此脚本位于我的主页底部,该脚本包含在一些 cfoutput 标签中:
<cfif #selected_main_details.X# IS "">
settab(3, false);
<cfelse>
settab(3, true);
</cfif>
function settab(num, enable){
var panel = $('.thumbNav a.panel' + num);
if (enable){
panel
.removeClass('false')
.unbind('click')
.bind('click', function(){
panel.closest('.anythingSlider').find('.anythingBase').data('AnythingSlider').gotoPage(num);
return false;
})
} else {
panel
.addClass('false')
.unbind('click focusin')
.bind('click', function(){
return false;
})
}
}
I'm using the AnythingSlider tool and am having some trouble with the css and js on this. Basically, the slider has a number of navigation tabs that help jump from slide to slide. I want to change this so that when a coldfusion conditional runs, certain tabs will either remain in a default state or become inactive (change color of tab to grey, not let anything happen when user clicks on that tab.)
So basically, my CF would be something like
<cfif #X# is ""> //if true, make tab #2 not clickable, change color to grey
//else, if false, keep tab normal.
The slider is basically set up in html like this:
<ul>
<li></li> //slide #1
<li></li> //slide #2 etc etc
</ul>
I had the idea that maybe I could set up a class li class="false" as an example and have two li tags per 'slide' (show one if x is true, the other if not.)
So, I'm not sure if this makes sense but mostly, I need a hand manipulating the CSS. The code for the slider tabs looks like:
div.anythingSlider.activeSlider .thumbNav a.cur, div.anythingSlider.activeSlider .thumbNav a {
background-color: #7C9127;
}
UPDATE Well, I don't get it. This is the code at the end of my page (just before ending BODY tag. I threw some alerts in there just to make sure the code runs and it does. But, nothing happens. Tabs don't become inactive and color never changes.
I altered anythingslider.css to include this:
div.anythingSlider.activeSlider .thumbNav a.false,
div.anythingSlider.activeSlider .thumbNav a.false:hover { background: #555; }
and this is at the bottom of my main page. This script is wrapped in some cfoutput tags:
<cfif #selected_main_details.X# IS "">
settab(3, false);
<cfelse>
settab(3, true);
</cfif>
function settab(num, enable){
var panel = $('.thumbNav a.panel' + num);
if (enable){
panel
.removeClass('false')
.unbind('click')
.bind('click', function(){
panel.closest('.anythingSlider').find('.anythingBase').data('AnythingSlider').gotoPage(num);
return false;
})
} else {
panel
.addClass('false')
.unbind('click focusin')
.bind('click', function(){
return false;
})
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您只想更改选项卡颜色,请使用此 css
如果您想实际禁用选项卡,则需要做更多工作。我将这个函数放在一起来启用或禁用特定选项卡。授予此功能将破坏该选项卡的哈希标签功能,并且它不会禁用键盘或任何针对该面板的脚本 - 这需要对插件进行一些更改(演示)。
按如下方式使用上述函数
如果页面上有多个 AnythingSlider,则应按如下方式定义面板变量,并使用针对特定滑块的
#slider
:如果只有一个,那么这个较短的变量就可以工作
禁用该选项卡,如下所示:
启用该选项卡,如下所示:
If you want to just change the tab color, use this css
It's a bit more work if you want to actually disable the tab. I put together this function to enable or disable a specific tab. Granted this function will break the hash tag functionality for that tab and it doesn't disable the keyboard or any script that targets that panel - that would require some changes to the plugin (Demo).
Use the above function as follows
If you have more than one AnythingSlider on the page, then the panel variable should be defined as follows with the
#slider
targeting the specific slider:if there is only one, then this shorter variable will work
Disable the tab as follows:
Enable the tab as follows: