Results 1 to 8 of 8

Thread: Can I get Simple Controls Gallery v1.3 to run with jQuery v1.3.2 instead of 1.2.6?

  1. #1
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Can I get Simple Controls Gallery v1.3 to run with jQuery v1.3.2 instead of 1.2.6?

    1) Script Title: Simple Controls Gallery v1.3

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

    3) Describe problem:
    Hi, thank you for this cool gallery script!
    I wonder if there is any chance the script would run with a different version of jQuery than 1.2.6, i.e. 1.3.2?
    I have integrated it into a WordPress test site and it works fine – only does the page have to load 2 different versions of the jQuery library now, which I'm afraid might cause problems in the future.
    I'm not a javascript programmer myself, but I can read and modify JS alright, so don't hesitate to put me to work.
    Thanks for your advice!
    Last edited by chpo; 12-28-2009 at 08:04 PM. Reason: Resolved

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Simple Controls Gallery should work with jQuery 1.3.2 as is already actually. For example, this works for me:

    Code:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    
    <style type="text/css">
    
    /*Make sure your page contains a valid doctype at the top*/
    #simplegallery1{ //CSS for Simple Gallery Example 1
    position: relative; /*keep this intact*/
    visibility: hidden; /*keep this intact*/
    border: 10px solid darkred;
    }
    
    #simplegallery1 .gallerydesctext{ //CSS for description DIV of Example 1 (if defined)
    text-align: left;
    padding: 2px 5px;
    }
    
    </style>
    
    <script type="text/javascript" src="simplegallery.js">
    
    /***********************************************
    * Simple Controls Gallery- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
    ***********************************************/
    
    </script>
    
    <script type="text/javascript">
    
    var mygallery=new simpleGallery({
    	wrapperid: "simplegallery1", //ID of main gallery container,
    	dimensions: [250, 180], //width/height of gallery in pixels. Should reflect dimensions of the images exactly
    	imagearray: [
    		["http://i26.tinypic.com/11l7ls0.jpg", "http://en.wikipedia.org/wiki/Swimming_pool", "_new", "There's nothing like a nice swim in the Summer."],
    		["http://i29.tinypic.com/xp3hns.jpg", "http://en.wikipedia.org/wiki/Cave", "", ""],
    		["http://i30.tinypic.com/531q3n.jpg", "", "", "Eat your fruits, it's good for you!"],
    		["http://i31.tinypic.com/119w28m.jpg", "", "", ""]
    	],
    	autoplay: [true, 2500, 2], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]
    	persist: false, //remember last viewed slide and recall within same session?
    	fadeduration: 500, //transition duration (milliseconds)
    	oninit:function(){ //event that fires when gallery has initialized/ ready to run
    		//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
    	},
    	onslide:function(curslide, i){ //event that fires after each slide is shown
    		//Keyword "this": references current gallery instance
    		//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
    		//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
    	}
    })
    
    </script>
    
    <body>
    
    <div id="simplegallery1"></div>
    DD Admin

  3. #3
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the quick reply!
    Strange, that call works for me as well. But if I try to rely on the built-in jquery-call of WordPress, nothing works at all.

    I assume this gets off-topic now, since the script itself doesn't seem to be the problem. Just one more description, maybe this has come to your ears before. If not, give me the thumbs-down.

    WordPress generates a jquery-call via PHP into the head-section of the page:
    Code:
    <?php wp_head() ?>
    With that function several script-calls are generated, i.e:
    Code:
    <script type="text/javascript" src="[mydomain]/wp-includes/js/jquery/jquery.js?ver=1.3.2"></script>
    <script type='text/javascript' src='[mydomain]/wp-content/plugins/[myplugin]/jquery-1.2.6.js?ver=1.2.6'></script>
    <script type="text/javascript" src="[mydomain]/wp-content/plugins/[myplugin]/simplegallery.js?ver=1.3"></script>
    The first one comes from WP itself, the latter two I added via a PHP-hook. If I remove the 1.2.6-call from that hook, I get:
    Code:
    <script type="text/javascript" src="[mydomain]/wp-includes/js/jquery/jquery.js?ver=1.3.2"></script>
    <script type="text/javascript" src="[mydomain]/wp-content/plugins/[myplugin]/simplegallery.js?ver=1.3"></script>
    which should work alright, but it doesn't. The gallery just doesn't appear. Seems to me like simplegallery.js doesn't get a connection with jquery.

    Thanks a bunch for any more ideas, I'm somewhat stuck here.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The easiest way to start figuring this out would be if we had a link to the page using this:

    Code:
    <script type="text/javascript" src="[mydomain]/wp-includes/js/jquery/jquery.js?ver=1.3.2"></script>
    <script type="text/javascript" src="[mydomain]/wp-content/plugins/[myplugin]/simplegallery.js?ver=1.3"></script>
    Then we could see what scripts are actually being used by that page.
    - John
    ________________________

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

  5. #5
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks for responding! Here's the link:
    http://test.sackermann.de/en/fine-arts/malerei/jerba
    (Same as the link on the words "WordPress Test Site" in my initial post, but that might not have come across so well.)
    The part in question is around line 60.

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That version of jQuery has at its end:

    Code:
    jQuery.noConflict();
    If you could remove that, it should work. But it would probably mess up other things you are doing or might do on this or other pages. And it might not be so easy to remove.

    Here's an alternative. In the simplegallery.js file, find this line (bold) and add the highlighted:

    Code:
    (function($){
    simpleGallery.prototype={
    Then at the end of the file, add this:

    Code:
    })(jQuery);
    - John
    ________________________

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

  7. The Following 2 Users Say Thank You to jscheuer1 For This Useful Post:

    AshleyQuick (01-07-2010),chpo (12-28-2009)

  8. #7
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Perfect! Works like a charm. Thanks so much, John!

  9. #8
    Join Date
    Aug 2005
    Posts
    54
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    This solution worked for me on Wordpress as well. Thanks and God Bless!!

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
  •