Jquery mobile change window.location.href to mobile.changePage

天大地大妈咪最大 提交于 2019-12-12 17:27:12

问题


I have a short question to JQuery mobile

I Have the following script and want to have a data transition=slide but it is not working with window.location.href. So i want to change it to $.mobile.changePage. But I don't get it.

Here is the script;

var category_data;
$(document).ready(function () {
    $('#search_category_form').bind('submit', function(){
        var form = $('#search_category_form');
        var data = form.serialize();

        $.post('index.html', data, function(){
            category_data = data; 
            window.location.href = 'index.html#search_general';
        });

        return false;
    });        

Thank you for your help


回答1:


$.mobile.changePage() is now deprecated, however you can change your code to:

// [deprecated] $.mobile.changePage("index.html#search_general", {transition: "slide"});
$.mobile.pageContainer.pagecontainer("change", "index.html#search_general", {transition: "slide"});


来源:https://stackoverflow.com/questions/24496350/jquery-mobile-change-window-location-href-to-mobile-changepage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!