样式化原始元素使用Jquery Mobile从JSP标记生成

时间:2013-12-01 10:50:48

标签: javascript jquery css jsp jquery-mobile

我有一个JSP页面,我需要使用JQM设置样式。 catch是所有html元素都是由JSP标记库(EMC Documentum wdk框架)生成的。问题是我不能将JQM属性添加到这些JSP标记来设置它们的样式,因为它们抛出异常,指出JQM属性是无效属性(这是JSP标记正常工作的方式)。 JQM自动将默认样式应用于这些生成的html元素。但我想要的是改变一些JQM样式并添加我想要的东西。例如,我的页面上生成了三个按钮。在JQM将其默认样式应用于这些按钮后,它们将显示为块级元素,并且它们占据页面的整个宽度。我想将它们更改为内联按钮,以便它们出现在一行中,并且它们的宽度成为其内容的宽度。非常感谢有人可以指导我以最好的方式做到这一点,因为我必须非常关注页面加载的速度。 我想知道 1)如何添加课程 2)如何更改属性(例如:data-theme) 3)实现1)和2)

的最佳页面事件

以下是我正在尝试做的事情

   <dmf:html>
    <dmf:head>
        <dmf:webform />
            <script src='<%=Form.makeUrl(request, "/global/pages/pwcspecific/web/mobile/js/jqueryMobile/jquery-1.9.1.js")%>'></script>
            <script src='<%=Form.makeUrl(request, "/global/pages/pwcspecific/web/mobile/js/jqueryMobile/jquery.mobile-1.3.2.min.js")%>'></script>
            <link rel="stylesheet" href="<%=Form.makeUrl(request,"/global/pages/pwcspecific/web/mobile/js/jqueryMobile/jquery.mobile-1.3.2.min.css")%>">
            <meta name="viewport" content="width=device-width, initial-scale=1">
            <script>
                $(document).on('pageinit', '#dmsMobile', function () {
                    // This is where I try to change the things..
                        $('#btn1').addClass("ui-btn-inline");
                        $('#btn2').addClass("ui-btn-inline");
                        $('#btn3').addClass("ui-btn-inline");
                });
            </script>
    </dmf:head>
    <dmf:body >
        <dmf:form>
            <div data-role="page" id="dmsMobile">
                <div data-role="header" data-theme="b">
                    -------
                </div>

                <div data-role="content">
                    <!--buttons generated by JSP tags. These styled by JQM with default stying 
                    (block level and occupies the entire width of the page)
                    -->
                    <button type="button" id="btn1">Button1</button>
                    <button type="button" id="btn2">Button2</button>
                    <button type="button" id="btn3">Button3</button>
                </div>
            </div>
        </dmf:form> 
    </dmf:body>
</dmf:html>

问候!

0 个答案:

没有答案