are*_*owe 0 javascript css ajax jquery
如何将类添加到li
已分配给它的类的现有类中?
我目前的代码是 http://jsfiddle.net/GbPdV/
我想将"Open"类添加到:
< li class="dropdown hover carticon cart" >
Run Code Online (Sandbox Code Playgroud)
我想这必须发生在:(不确定)
if ( response.Status == "Success" )
{
$.ajax({
type: "GET",
url: "dmiajax.aspx?request=FloatingCart&extra=" + rnd(),
dataType: "html",
success: function(response) {
var floatingCart = $("ul.dropdown-menu.topcart");
if (floatingCart.length == 0) {
floatingCart = $('<ul class="dropdown-menu topcartopen"></ul>').insertBefore(".pull-right");
floatingCart.hoverIntent({
over: function() {},
timeout: 200,
out: function() {
$(this).stop(true, true).filter(":visible").hide("drop", {
direction: "down"
});
}
});
}
Run Code Online (Sandbox Code Playgroud)
只是用 .addClass
floatingCart.addClass("Open");
Run Code Online (Sandbox Code Playgroud)
success: function(response) {
var floatingCart = $("ul.dropdown-menu.topcart");
//HERE
floatingCart.addClass("Open");
if (floatingCart.length == 0) {
//OR HERE
floatingCart = $('<ul class="dropdown-menu topcartopen"></ul>')
.insertBefore(".pull-right")
.addClass("Open");;
floatingCart.hoverIntent({
over: function() {},
timeout: 200,
out: function() {
$(this).stop(true, true).filter(":visible").hide("drop", {
direction: "down"
});
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
97 次 |
最近记录: |