Javascript 选择选项后关闭“选择框”容器。冲突代码?
我正在使用一些不同的脚本,它们似乎在某种程度上相互冲突。欢迎提供更好的代码建议,以用于本部分的内容交换部分。我喜欢下拉选择选项的风格和功能 第一个脚本来自Codrops: 我将该样式与此处的内容交换功能相结合: 在我添加内容交换代码之前,Codrops示例的功能在我的站点上非常有效 以下是(我认为)单击某个选项后控制关闭选择选项的内容: Codrops中selectFx.js的第238行:Javascript 选择选项后关闭“选择框”容器。冲突代码?,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我正在使用一些不同的脚本,它们似乎在某种程度上相互冲突。欢迎提供更好的代码建议,以用于本部分的内容交换部分。我喜欢下拉选择选项的风格和功能 第一个脚本来自Codrops: 我将该样式与此处的内容交换功能相结合: 在我添加内容交换代码之前,Codrops示例的功能在我的站点上非常有效 以下是(我认为)单击某个选项后控制关闭选择选项的内容: Codrops中selectFx.js的第238行: /** * open/close select * when opened show the de
/**
* open/close select
* when opened show the default placeholder if any
*/
SelectFx.prototype._toggleSelect = function() {
// remove focus class if any..
this._removeFocus();
if( this._isOpen() ) {
if( this.current !== -1 ) {
// update placeholder text
this.selPlaceholder.textContent = this.selOpts[ this.current ].textContent;
}
classie.remove( this.selEl, 'cs-active' );
}
else {
if( this.hasDefaultPlaceholder && this.options.stickyPlaceholder ) {
// everytime we open we wanna see the default placeholder text
this.selPlaceholder.textContent = this.selectedOpt.textContent;
}
classie.add( this.selEl, 'cs-active' );
}
}
以及为内容交换添加的删除关闭功能的代码:
$('.info-container div').hide();
$('.div-toggler li a').click(function () {
if ($(this).hasClass('active') == true) {
return false;
} else {
$('a.active').removeClass('active');
$(this).addClass('active');
$('.info-container div').fadeOut();
var contentToLoad = $(this).attr('href');
$(contentToLoad).delay(400).fadeIn("slow");
return false;
}
});
当前工作副本在这里。。不合理的机构/网络
选择项按其应有的方式显示,内容按其应有的方式交换,但选择一项后选项仍保留在页面上。它应该像Codrops示例一样关闭。工作副本链接错误。请更正。我无法添加两个以上的链接,第三个没有http://Here is,抱歉:工作副本链接错误。请更正。我无法添加两个以上的链接,第三个链接没有http://Here is,抱歉: