I'm trying to integrate some features that are found jQuery Mobile into a WordPress plugin. I am NOT targeting mobile devices specifically, I just like some of the features in the framework. The problem I am having is that it seems jQuery Mobile CSS is taking over the native WP CSS and changing the styling. Also, some of the jQuery Mobile features don't work properly. I use wp_register_style and wp_enqueue_style to load the styles as well as wp_enqueue_script to load the script like this:
wp_register_style( 'jquery-mobile-style', 'http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css');
wp_register_style( 'jquery-mobile-style', 'http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css');
wp_enqueue_script('jquery');
wp_enqueue_script('jq-script', 'http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js');
I am specifically working with the Panel. I inject the panel code into the page like this:
jQuery(document).ready(function($){
var s = '<div data-role="panel" id="myPanel" data-display="overlay" data-theme="b">';
s += '<div class="panel-content">';
s += '<h3>Default panel options</h3>';
s += '<a href="#demo-links" data-rel="close" data-role="button" data-theme="c" data-icon="delete" data-inline="true">Close panel</a>';
s += '</div><!-- /content wrapper for padding -->';
s += '</div><!-- /defaultpanel -->';
$(s).appendTo('#page');
Then I add a link to open the panel:
$('.entry-content').append('<div data-role="content"><a href="#myPanel" data-rel="panel" data-role="button">Share</a></div>');
Only the "Overlay" feature works. It seems like it is a WordPress/jQuery Mobile issue as I can get it working in a standalone PHP page.