Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to move both prev and next pjax page during transition?
    primarykey
    data
    text
    <p>Hello everyone and good Friday! I already have a decent transitional effect but essentially it slides a page out then slides next page in. I am using Yii and I'm trying to slide the current view and clicked view into a div at the same time so it lookes like you're moving a hypothetical camera across two pages (hope that make sense)</p> <p><strong>Here is the JS:</strong></p> <pre><code>var slideWhere = "-100%"; var slideFrom = "100%"; var slideContainer = '#testdiv'; var htmlData = null; /** @function ? Grabs a Yii based URL(controller/action) via ajax then slides it into view. @paramset Classic @param {String} yUrl - Yii based url (controller/action) @param {optional String} dMove - can be 'right' or 'left' : default is 'left' @param {optional String} dWhat - specific element, class, or id you are replacing. default is '#testdiv" */ function pLoad(yUrl, dMove, dWhat) { dMove = typeof dMove !== 'undefined' ? dMove : 'left'; dWhat = typeof dWhat !== 'undefined' ? dWhat : '#testdiv'; slideContainer = dWhat; // If you type anything else but 'right' it will go left (default) if (dMove == 'right') { slideWhere = "100%"; slideFrom = "-100%"; } else { slideWhere = "-100%"; slideFrom = "100%"; } $.pjax({ url: yUrl, container: slideContainer }); } $(document).on('pjax:send', function() { if ($("#mobileToggle").css("display") == 'none') { return; } $(slideContainer).animate({marginLeft: slideWhere },250); }); $(document).on('pjax:complete', function() { if ($("#mobileToggle").css("display") == 'none') { return; } $(slideContainer).css("margin-left",slideFrom); $(slideContainer).animate({marginLeft: "0%" },250); }); $(document).on('pjax:error', function() {return false;}); </code></pre> <p><strong>Here is the HTML:</strong> Experimental pJax view<br/></p> <pre><code> &lt;button style="previous" onClick="pLoad('/test/tpage1')"&gt;Test One &lt;/button&gt; &lt;button style="previous" onClick="pLoad('/test/tpage2')"&gt;Test Two&lt;/button&gt; &lt;button style="next" onClick="pLoad('/test/tpage3','right')"&gt;Test Three&lt;/button&gt; &lt;br /&gt; --- Test Div --- &lt;div id="testdiv" &gt;update area&lt;/div&gt;&lt;br/&gt; --- End div -- </code></pre> <p>I already have it working very well, and it only slides when browser width is small (being controller by css!) - question is, how to make both pages slide without adding too much? What is the simplest way? </p> <p>Any ideas? thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload