How to get som jQuery Mobile Features in WordPress -


i'm trying integrate features found jquery mobile wordpress plugin. not targeting mobile devices specifically, of features in framework. problem having seems jquery mobile css taking on native wp css , changing styling. also, of jquery mobile features don't work properly. use wp_register_style , wp_enqueue_style load styles wp_enqueue_script load script 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 working panel. inject panel code page 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 padding -->';     s += '</div><!-- /defaultpanel -->';      $(s).appendto('#page'); 

then add link open panel:

    $('.entry-content').append('<div data-role="content"><a href="#mypanel" data-rel="panel" data-role="button">share</a></div>'); 

only "overlay" feature works. seems wordpress/jquery mobile issue can working in standalone php page.

first of don't think going work you. jquery mobile panel work part of data-role="page" div. change version 1.4 stuck. whole content must wrapped div:

<div data-role="page" id="pageid"></div> 

this bug opened in jquery mobile github repository, link. can see planed version 1.4. advise wait it. version 1.4 should come around q2 of year.

even if go road need prevent jquery mobile restyling content. can prevented if customize jqm framework customization tool.

next step remove document ready event , replace correct jquery mobile page event- problem here document ready can trigger before page loaded dom , panel not attached. find out more page events read other answer: jquery mobile: document ready vs page events.

and when dynamically create panel need force jquery mobile style correctly. @ other answer: query mobile: markup enhancement of dynamically added content. search chapter: enhance full page content (header, content, footer).


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -