如何在此代码中使用EditPhoto变量? 我在这里添加完整的代码。 我如何在这里使用EditPhoto变量: ** EditPhoto:{name:"编辑此照片",图标:"编辑"} **
$(document).ready(function() {
$('#sortable li').click(function() {
id = $(this).attr("id");
id = id.replace("GaleriSirala_", "");
alert(idBul);
EditPhoto = ("edit-photo&EditNow=" + id);
});
});
$(function() {
$.contextMenu({
selector: '.context-menu-one',
callback: function(key, options) {
var m = "index.php?sayfa=" + key;
$(location).attr('href', m)
},
items: {
EditPhoto :{name: "Edit This Photo", icon: "edit"},
}
});
$('.context-menu-one').on('click', function(e){
console.log('clicked', this);
})
});
$j('.GaleriListele').click(function() {
alert( $(this).childen('a').attr('id'));
});
答案 0 :(得分:0)
使用[]表示法:
尝试这样的事情
var items = {}
EditPhoto = ("EditPhoto&EditNow=" + id);
items[EditPhoto] = {name: "Edit This Photo", icon: "edit"}
$(function() {
$.contextMenu({
selector: '.context-menu-one',
callback: function(key, options) {
var m = "index.php?page=" + key;
$(location).attr('href', m)
},
items: items
});
答案 1 :(得分:0)
var items = {}
EditPhoto = ("EditPhoto&EditNow=" + id);
items[EditPhoto] = {name: "Edit This Photo", icon: "edit"}
$(function() {
$.contextMenu({
selector: '.context-menu-one',
callback: function(key, options) {
var m = "index.php?sayfa=" + key;
$(location).attr('href', m)
},
items: items
});
});
$j('.GaleriListele').click(function() {
alert( $(this).childen('a').attr('id'));
});