我正在尝试实现一个插件:
$(".myTbl th:nth-child(1)").truncate({
width: "200",
after: "…",
center: false,
addtitle: true
});我没有使用固定的宽度值,而是使用脚本动态计算宽度并将其设置为a变量,但是当我插入代码时,它会中断。我遗漏了什么?这都是用PHP代码实现的
echo '
var myWidth = 150;
$(".myTbl th:nth-child(1)").truncate({
width: myWidth ,
after: "…",
center: false,
addtitle: true
}); ';发布于 2011-12-03 01:48:33
也许插件需要一个字符串文字。
服务器端:
echo '
$(".myTbl th:nth-child(1)").truncate({
width: "150" ,
after: "…",
center: false,
addtitle: true
});
';js侧:
echo '
var myWidth = "150";
$(".myTbl th:nth-child(1)").truncate({
width: myWidth ,
after: "…",
center: false,
addtitle: true
});
';https://stackoverflow.com/questions/8360398
复制相似问题