有没有什么方法来编辑醉酒的位置或重力(我不知道什么是正确的)?插件本身有几个重力选项,您可以通过脚本分配这些选项:
nw | n | ne | w | e | sw | s | se我目前使用的是s位置,就像您在小提琴中看到的:http://jsfiddle.net/cnLW8/
但我想知道Tipsy的位置是否可以编辑,因为它显示在元素的中心。不是旁边,上面还是更远,而是相对接近中心?
目前,我通过将.tipsy类的css属性设置为:
.tipsy{
margin-top: 30px;
}但我认为有一些更聪明的解决方案,通过脚本或其他方式编辑.
欢迎任何帮助或建议。
发布于 2013-09-26 18:22:31
我还没有能够测试这一点,但我认为在tipsy.js中的开关块中添加一个新的情况就可以了。
我增加了案例z,用s的数学得到左边的值,从w得到最大值,结果应该是死中心。只需将案例添加到js文件中,并使用case z重新加载它。
switch (gravity.charAt(0)) {
case 'n':
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
break;
case 's':
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
break;
case 'e':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
break;
case 'w':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
break;
case 'z':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width / 2 - actualWidth / 2};
break;
}https://stackoverflow.com/questions/19031601
复制相似问题