Image on Sliding Panel
I've created a sliding panel according to the tutorial. I'm trying to add a dynamic image based on which listitem is clicked.
I've searched how to do this and am using jQuery prepend command to add the image. Works fine for the first one...
...and hilariously terrible for any subsequent clicks.
How would you recommend adding the image to the sliding panel?
PS...here's the Javascript I use:
precode
var Panel = function() {
var that = {},
_panel = $('#mypanel');
Code: Select all
var page = _panel.parents("[data-role=page]");
page.append(_panel);
_panel.on("panelbeforeopen", function( event, ui ) { //Events
$("#pastorName").text(localStorage.getItem("selectedConnectPastor"));
$("#pastorImage").prepend('<img id="theImg" src="'+localStorage.getItem("selectedConnectImageURL")+'" width=100px />');
$("#pastorRequest").text(localStorage.getItem("selectedConnectRequest"));
$("#close_panel").die().live("click", function() {
that.close();
});
});
that.open = function() {
_panel.panel("open");
}
that.close = function() {
_panel.panel("close");
}
Code: Select all
return that; };
/code/pre