如何使用jQuery动态移动选项卡位置?
在Accordion jQuery功能中,如何在不使用UI插件的情况下使用左、右、上、下动态移动选项卡位置 示例:有一个下拉列表,其中包含四个值:1.top 2.bottom 3.left和4.right如何使用jQuery动态移动选项卡位置?,jquery,Jquery,在Accordion jQuery功能中,如何在不使用UI插件的情况下使用左、右、上、下动态移动选项卡位置 示例:有一个下拉列表,其中包含四个值:1.top 2.bottom 3.left和4.right If i click on top - Tabs should display top to bottom direction If i click on bottom - Tabs should display bottom to top direction If i click on
If i click on top - Tabs should display top to bottom direction
If i click on bottom - Tabs should display bottom to top direction
If i click on left - Tabs should display left to right direction
If i click on left - Tabs should display right to left direction
您可以尝试以下代码。请注意,此代码不完整。您需要添加所有案例
$("select").change(function() {
var str = "";
$("select option:selected").each(function() {
str += $(this).text() + " ";
});
switch (str) {
case 'top':
$("#tabs").addClass("ui-tabs-vertical ui-helper-clearfix");
$("#tabs li").removeClass("ui-corner-top").addClass("ui-corner-left");
break;
case 'bottom':
// fix the classes
$( ".tabs-bottom .ui-tabs-nav, .tabs-bottom .ui-tabs-nav > *" )
.removeClass( "ui-corner-all ui-corner-top" )
.addClass( "ui-corner-bottom" );
// move the nav to the bottom
$( ".tabs-bottom .ui-tabs-nav" ).appendTo( ".tabs-bottom" );
break;
case 'left':
// change the required classes
break;
case 'right':
// change the required classes
break;
}
});
你能解释一下你所说的从左到右方向和从右到左方向是什么意思吗?手风琴是垂直的。假设有4个标签,即标签1,标签2,Tab3和Tab4它们是从上到下排列的,这是默认情况,如果我选择“下”,它应该从下到上显示,即Tab4到tab1,从左到右,它应该从tab1到Tab4,从左到右,如果我单击“右”,它应该从Tab4到tba1,从左到左显示。请问这些ui选项卡是垂直的吗以及ui助手clearfix和类似的类。这些是jQuery选项卡插件使用的类。您可以在中找到这些类。查看页面(jQuery tabs文档)中示例的源代码。您好,在本例中,当我从“选择”下拉列表中选择一个值时,所选值不会出现在切换案例中。它显示NAN u能否为我提供切换案例功能