Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent JQuery-Mobile add div element automatically

I have div element originally like this..

<body>
    <canvas id="pageflip-canvas"></canvas>
    <div id="pages">
        <section>

        </section>
    </div>
<script type="text/javascript" src="index.js"></script>
</body>

but when I run with JQuery-Mobile It become like this

<body class="ui-mobile-viewport ui-overlay-c">
<div data-role="page" data-url="/C:/AppServ/www/guiBook2/index.html"
 tabindex="0"  class="ui-page ui-body-c ui-page-active" style="min-height: 681px;">
    <canvas id="pageflip-canvas" width="1366" height="681"></canvas>
    <div id="pages">
        <section style="z-index: 1;">

        </section>
    </div>
<script type="text/javascript" src="index.js"></script>

</div><div class="ui-loader ui-corner-all ui-body-a ui-loader-default"><span class="ui-icon ui-icon-loading"></span><h1>loading</h1></div></body>

How to prevent it create these DIV I'm ok with class css

but additional div make content width change.

Thank In Advance

like image 519
Jongz Puangput Avatar asked Jun 20 '13 07:06

Jongz Puangput


1 Answers

This can't be done. If jQuery Mobile is used it will take over the web application. This is to be expected because jQuery Mobile is not a classic framework. Because everything is done via ajax every content MUST be wrapped into DIV with an attribut data-role="page". If this DIV dont exist like in this question it will be created automatically and it cant be prevented.

There are several methods that will prevent content been styled with jQuery Mobile CSS but nothing can prevent content been wrapped into data-role="page" DIV.

If you want to learn more about these methods take a look at my ARTICLE, to be transparent it is my personal blog. Or find it HERE. Everything is described in chapter called: Methods of markup enhancement prevention.

Bottom DIV-s are also needed because they are used too indicate page/content loading, basically it is a necessary jQuery Mobile component. But it can be removed if AJAX is turned off. But what is the point of jQuery Mobile if AJAX is turned off.

There's one last thing to consider, if only some jQuery Mobile functionalities are needed then it is possible to rebuild framework so it can included only needed functionalities. This link can be found HERE, don't forget to select needed jQuery Mobile version.

like image 53
Gajotres Avatar answered Oct 30 '22 22:10

Gajotres