Results 1 to 6 of 6

Thread: Dynamic Ajax Content and Pretty Photo

  1. #1
    Join Date
    Mar 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Dynamic Ajax Content and Pretty Photo

    1) Script Title: Dynamic Ajax Content

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...jaxcontent.htm

    3) Describe problem:

    Hi there,

    I got a problem regarding the loading of the PrettyPhoto script (http://www.no-margin-for-errors.com/...ightbox-clone/). It works perfectly the first time opened but after using the navigation the script is not running anymore..

    Is there a way to reload it?

    Many thanks in advance..

  2. #2
    Join Date
    Mar 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I have exactly the same problem, not with Pretty Photo, but with other 2 javascritps... first time work then it works sometimes and sometimes no... if u find a solution let me know
    Last edited by jscheuer1; 03-28-2011 at 03:44 PM. Reason: remove broken link

  3. #3
    Join Date
    Mar 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yeah, seems to be a usual problem.
    I somehow need to re-initialize prettyPhoto every time I load new picture through ajax. But got no idea how to do that or where to add the code..

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,135
    Thanks
    44
    Thanked 3,231 Times in 3,192 Posts
    Blog Entries
    12

    Default

    If Pretty Photo is reasonably well written, and you 're using:

    Code:
    	<script type="text/javascript" charset="utf-8">
    		$(document).ready(function(){
    			$("a[rel^='prettyPhoto']").prettyPhoto();
    		});
    	</script
    to initialize it in the first place, edit this part of the AJAX script:

    Code:
    function loadpage(page_request, containerid){
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    document.getElementById(containerid).innerHTML=page_request.responseText
    }
    to:

    Code:
    function loadpage(page_request, containerid){
    	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
    		document.getElementById(containerid).innerHTML=page_request.responseText;
    		$("a[rel^='prettyPhoto']").prettyPhoto();
    	}
    }
    If you're using a different initialization, use the corresponding part of it there instead.

    If you want more help:

    Please post a link to a page on your site that contains the problematic code so we can check it out.


    As a side note - jQuery has robust AJAX routines, so you should consider using it for the AJAX part, save some overhead on loading the page. But doing so might require some custom coding and an understanding of jQuery AJAX functions, unless you can find a jQuery AJAX plugin that's easily adaptable to your purposes.
    Last edited by jscheuer1; 03-28-2011 at 03:49 PM. Reason: English usage
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default fixed

    John you're great!

    I had to modify a bit but it works now!

    function loadpage(page_request, containerid){
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
    document.getElementById(containerid).innerHTML=page_request.responseText;
    $(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'slow',theme:'dark_rounded',slideshow:4000, autoplay_slideshow: false});
    }
    }

    thank you very much!

  6. #6
    Join Date
    Sep 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help me

    I have a website aittech.vn/demo/joomla/joomla15_test/index.php?option=com_rokquickcart&view=rokquickcart&Itemid=2, when you click : Your Cart: (x items), it loading prettyPhoto (pwd.js). It works perfectly the first time opened but after click to increase product in prettyPhoto then not increase the number of products.
    Last edited by jscheuer1; 09-17-2011 at 03:47 AM. Reason: formatting

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •