风格不是';t在jquery mobile 1.2.0中更新可折叠div
未更新可折叠div的样式。我使用的是最新的jquery mobile 1.2.0版本。我的代码如下。请告诉我遗漏了什么 HTML风格不是';t在jquery mobile 1.2.0中更新可折叠div,jquery,jquery-mobile,Jquery,Jquery Mobile,未更新可折叠div的样式。我使用的是最新的jquery mobile 1.2.0版本。我的代码如下。请告诉我遗漏了什么 HTML 使用的javascript: $(document).bind("mobileinit", function(){ $.mobile.changePage.defaults.changeHash = false; $.mobile.collapsibleset.prototype.options.initSelector =
使用的javascript:
$(document).bind("mobileinit", function(){
$.mobile.changePage.defaults.changeHash = false;
$.mobile.collapsibleset.prototype.options.initSelector = ".collpasibleSetClass";
initEvents();
});
var initEvents = function(){
$.mobile.changePage( "#eventDetails", { transition: "slide"} );
var $description = $('.collapsibleClass');
$description.html('');
var $title = $('<h3/>').append(eventObj.eventTitle);
var $eventDetails = $('<p/>').append(eventObj.eventDescription);
$description.append($title).append($eventDetails);
$('.collapsibleSetClass').collapsibleset("refresh");
}
$(document).bind(“mobileinit”,function(){
$.mobile.changePage.defaults.changeHash=false;
$.mobile.collapsableset.prototype.options.initSelector=“.collpasibleSetClass”;
initEvents();
});
var initEvents=函数(){
$.mobile.changePage(#eventDetails“,{transition:“slide”});
变量$description=$('.collapsableclass');
$description.html(“”);
var$title=$('').append(eventObj.eventTitle);
var$eventDetails=$(“”).append(eventObj.eventDescription);
$description.append($title).append($eventDetails);
$('.collapsablesetclass').collapsableset(“刷新”);
}
您正在尝试刷新尚未初始化的小部件。您可以在mobileinit
事件处理程序中调用initEvents()
,该处理程序在初始化任何内容之前触发
因此,最有可能您真正需要做的就是删除刷新可折叠小部件的行,jQuery Mobile将自动初始化它们:
var initEvents = function(){
$.mobile.changePage( "#eventDetails", { transition: "slide"} );
var $description = $('.collapsibleClass');
$description.html('');
var $title = $('<h3/>').append(eventObj.eventTitle);
var $eventDetails = $('<p/>').append(eventObj.eventDescription);
$description.append($title).append($eventDetails);
//$('.collapsibleSetClass').collapsibleset("refresh");
}
var initEvents=function(){
$.mobile.changePage(#eventDetails“,{transition:“slide”});
变量$description=$('.collapsableclass');
$description.html(“”);
var$title=$('').append(eventObj.eventTitle);
var$eventDetails=$(“”).append(eventObj.eventDescription);
$description.append($title).append($eventDetails);
//$('.collapsablesetclass').collapsableset(“刷新”);
}
还请注意,必须在页面的HTML之后包含所有JS,否则您选择的HTML元素将不可用。因此,我建议在第一页使用pageinit
,而不是mobileinit
var initEvents = function(){
$.mobile.changePage( "#eventDetails", { transition: "slide"} );
var $description = $('.collapsibleClass');
$description.html('');
var $title = $('<h3/>').append(eventObj.eventTitle);
var $eventDetails = $('<p/>').append(eventObj.eventDescription);
$description.append($title).append($eventDetails);
//$('.collapsibleSetClass').collapsibleset("refresh");
}