Skip to content

Documentation needed: this requires jQuery 1.4.x #38

Closed

Description

@benshell

After debugging some weird glitches for awhile, I found that this plugin uses a function argument to .html() which was added in jQuery 1.4 (line 188). It should be documented that this plugin requires jQuery 1.4.x.

Activity

  1. Mottie commented on Dec 23, 2010

    @Mottie
    Contributor

    Ok, I added a Note in the Wiki... I could potentially change line 188 to be compatible with 1.3+ if you need.

  2. benshell commented on Dec 23, 2010

    @benshell
    Author

    Thanks for the quick reply! That'd be great if you want to change the code. I think this would be all that's needed for jQuery 1.3.2 compatibility, or at least all that I've found so far. I changed the line to this and it works:
    var oldHtml = $(this).html();
    var newHtml = oldHtml.replace(/<a/gi, '<span').replace(//a>/gi, '/span>');
    $(this).html(newHtml);

    I'll let you know if I find any other jQuery 1.3.2 incompatibilities. Unfortunately I can't upgrade jQuery for the site I'm working on.

    Thanks.

  3. Mottie commented on Dec 28, 2010

    @Mottie
    Contributor

    Hi Benshell!

    After messing around with the code I found a few other bits that need modified and a small bit of code that needs to be added. I thought about it and I don't think I want to add more code to the core just to make it compatible with an older jQuery version. But, I will show you here how to do it - basically it won't be released officially - I may change this in the future if more people want the change to be made permanent or I get some other feedback or opinions on this matter.

    All changes are to the jquery.anythingslider.js file:

    • Because $(null).length == 1 is true in jQuery 1.3.2 this line needs to be modified from this (line 47 in v1.5.6.2)

      base.$controls = $('<div class="anythingControls"></div>').appendTo( $(base.options.appendControlsTo).length ? $(base.options.appendControlsTo) : base.$wrapper);
      

      to this:

      base.$controls = $('<div class="anythingControls"></div>').appendTo( (base.options.appendControlsTo !== null && $(base.options.appendControlsTo).length) ? $(base.options.appendControlsTo) : base.$wrapper);
      
    • Because e.type for hovered doesn't match correctly, change this (line 99, v1.5.6.2)

      base.$wrapper.hover(function(e){
      

      to this:

      base.$wrapper.bind('mouseenter mouseleave', function(e){
      
    • HTML functions do not work as you pointed out above, so change line 188 to this:

      $(this).html( $(this).html().replace(/<a/gi, '<span').replace(/\/a>/gi, '/span>') );
      
    • Lastly, because delay() doesn't exist in jQuery 1.3.2, I figured it would be easiest to just copy the function. This was the bit of code that ultimately made me decide to not make anythingSlider backward compatible only because of the added length. Maybe it isn't enough to make it a big deal and I'll include it in the next version, we'll see:

      Add this to the end of the jquery.anythingslider.js file (outside of the enclosure)

      // Copied from jQuery 1.4.4 to make AnythingSlider backwards compatible to jQuery 1.3.2
      if (typeof jQuery.fn.delay === 'undefined') {
       jQuery.fn.extend({
        delay: function( time, type ) {
         time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; type = type || "fx";
         return this.queue( type, function() { var elem = this; setTimeout(function() { jQuery.dequeue( elem, type ); }, time ); });
        }
       });
      }
      

    If you are having trouble making the changes, here is the file with those changes: https://dl.dropbox.com/u/1510510/misc/jquery.anythingslider.for.jQuery1.3.2.js

  4. benshell commented on Dec 29, 2010

    @benshell
    Author

    This is awesome, thanks so much. I may not get back to working on this until next week, but when I do I'll be sure to let you know how these changes work!

  5. Mottie commented on Jan 29, 2011

    @Mottie
    Contributor

    Closing this issue

  6. dessol commented on Feb 14, 2011

    @dessol

    Getting the following error using jQuery 1.3.2

    Uncaught TypeError: Object # has no method 'swing'
    b.fx.stepu.js:19
    Fu.js:19
    b.fx.customu.js:19
    b.fn.extend.animateu.js:19
    b.extend.eachu.js:12
    b.fn.extend.animateu.js:19
    b.extend.eachu.js:12
    b.fn.b.eachu.js:12
    b.fn.extend.animateu.js:19
    $.anythingSlider.base.gotoPagejquery.anythingslider.1.3.2.js:390
    $.anythingSlider.base.buildNavigationjquery.anythingslider.1.3.2.js:255
    b.event.handleu.js:19
    b.event.add.E

  7. Mottie commented on Feb 14, 2011

    @Mottie
    Contributor

    Hi Dessol!

    I updated the version I had above (https://dl.dropbox.com/u/1510510/misc/jquery.anythingslider.for.jQuery1.3.2.js), just use it in place of the jquery.anythingslider.js file you have

  8. Mottie commented on Feb 21, 2011

    @Mottie
    Contributor

    Just as an update, I pushed version 1.5.7 which in the non-minified version has the "delay" code commented out at the end. If you un-comment out that code, AnythingSlider will be compatible with jQuery version 1.3.2. If you are using the minified version, just copy that code to the end of the minified code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions