jewome62
jewome62

Reputation: 75

How disable jquery mobile's style in the entire contents of a div?

I work on a jQuery Mobile's project.

In a page, I want use mobilescroll for an select (http://demo.mobiscroll.com/select#language=fr&display=inline)

I try data-role="none", but it doesn't work on the children and mobilescroll create their own tags.

How disable jQuery Mobile's style in the entire contents of a div ?

Thanks

Upvotes: 3

Views: 1128

Answers (1)

Omar
Omar

Reputation: 31732

It's possible to prevent jQuery Mobile from enhancing elements. however, following this solution will make your application slower than usual.

Demo

First, you need to globally set ignoreContentEnabled to true.

<head>
  <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
  <script>          
    $(document).on("mobileinit", function(){
      $.mobile.ignoreContentEnabled = true;
    });
  </script>
  <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>

And then, add data-enhance="false" attribute to elements which you don't want JQM to enhance. This is the reason why app becomes slow, because JQM checks for this attribute in all elements.

Upvotes: 1

Related Questions