苦苦挣扎,揭示窗口关闭在foundatoin

时间:2016-02-17 05:05:29

标签: css ruby-on-rails ruby-on-rails-4 rubygems zurb-foundation

我在导轨4.2.2上使用ruby,使用gem foundation-rails 6.1.2。 我已经在文档中安装了所有内容,现在尝试制作简单的显示模式窗口,就像在基础文档here

中一样

我已经导入了动作ui,但它仍然不起作用。这是苗条的代码:

public class JarFileClassTransformer implements ClassFileTransformer {

private String jarFileName = null;
protected Map<String, InputStream> classNames = new HashMap<>();
static Instrumentation instrumentation = null;

/**
 * Constructor.
 * @param jarFileName
 */
public JarFileClassTransformer(String jarFileName) {
    this.jarFileName = jarFileName;

    File file  = new File(jarFileName);
    System.out.println("Jar file '" + this.jarFileName + "' " + (file.exists() ? "exists" : "doesn't exists!"));

    if(file.exists()) {
        try {
            JarFile jarFile = new JarFile(file);
            Enumeration e = jarFile.entries();

            while (e.hasMoreElements()) {
                JarEntry je = (JarEntry) e.nextElement();
                if(je.isDirectory() || !je.getName().endsWith(".class")){
                    continue;
                }
                // -6 because of .class
                String jarClassName = je.getName().substring(0,je.getName().length()-6);
                jarClassName = jarClassName.replace('/', '.');
                System.out.println("Adding class " + jarClassName);
                this.classNames.put(jarClassName, jarFile.getInputStream(je));

            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}

@Override
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {

    if(classNames.containsKey(className.replace("/", "."))) {
        System.out.format("\n==> Found %s to replace with the existing version\n", className);
        try {

            Class c = loader.loadClass(className.replace("/", "."));
            System.out.println("Existing class: " + c);
            InputStream is = classNames.get(className.replace("/", "."));

            byte[] content = new byte[is.available()];
            is.read(content);

            System.out.println("Original class version: " + ((classfileBuffer[6]&0xff)<<8 | (classfileBuffer[7]&0xff)));
            System.out.println("Redefined class version: " + ((content[6]&0xff)<<8 | (content[7]&0xff)));

            System.out.println("Original bytecode: " + new String(classfileBuffer));
            System.out.println("Redefined byte code: " + new String(content));
            ClassDefinition cd = new ClassDefinition(c, content);
            instrumentation.redefineClasses(cd);

            return content;
        } catch (Throwable e) {
            e.printStackTrace();

        }

    }
    return classfileBuffer;
}

链接本身打开模态:

.reveal#exampleModal1 data-reveal='data-reveal'
    h1 Awesome. I Have It.
    p.lead Your couch. It is mine.
    p I'm a cool paragraph that lives inside of an even cooler modal. Wins!
    button.close-button data-close="data-close" aria-label="Close modal" type="button"
        span aria-hidden="true"&times;

所以模态是开放的,但第一次打开时有奇怪的风格。它太宽(内联样式被添加到模态中)并且关闭按钮不会关闭模态。如果我通过单击模态或ESQ外部关闭模态 - 它已关闭。第二次打开显示时,它的正确宽度为600px(控制台中的样式窗格显示现在样式来自某些css文件)。但关闭按钮仍然不起作用。

我做错了什么?有任何想法吗?谢谢

1 个答案:

答案 0 :(得分:0)

哦,由于在github上打开issue

,处理关闭按钮很容易

正如问题中所述,初始样式仍然存在问题..