Last post Dec 08, 2016 12:49 AM by issam1975
Member
12 Points
165 Posts
Dec 06, 2016 11:52 PM|issam1975|LINK
hi,
i have some trouble with a plugin that work with an older version of jquery but not with newers :/
it's originally from this page
http://tympanus.net/codrops/2011/06/09/grid-navigation-effects/
after some debugging it seems that these lines are guilty :
var currentRows = '', nextRows = ''; for( var i = 0; i < opts.rows; ++i ) { currentRows += '.tj_row_' + (config.currentRow + i) + ','; (dir === 1) ? nextRows += '.tj_row_' + (config.currentRow + opts.rows + i) + ',' : nextRows += '.tj_row_' + (config.currentRow - 1 - i) + ','; }
the error in the console is
jquery.min.js:4 Uncaught Error: Syntax error, unrecognized expression: .tj_row_1,.tj_row_2,.tj_row_3,(…)
if i comment them i don't have the error in the console but the pluging don't work properly .
this lines of code are working perfectly in jquery 1.6.1 but not in 1.9.1
any idea on what's going on and how to fix that please ?
thanks !
Star
8670 Points
2882 Posts
Dec 07, 2016 07:32 AM|Cathy Zou|LINK
Hi issam1975,
As far as I know, Jquery plugin was created based on some version Jquery,
For your problem, Grid Navigation work on Jquery 1.6.1 not work in 1.9.1. it seems that some method was update or changed in 1.9.1,
I think it is possible to make change in Jquery plugin to fix the problem.
As far as I know, Jquery provide conflict method, which allow us could use multiple Jquery at some time,
So, I suggest could use this method to use the two version Jquery.
https://api.jquery.com/jquery.noconflict/
Best regards
Cathy
All-Star
15186 Points
3888 Posts
Dec 07, 2016 09:32 AM|raju dasa|LINK
Hi,
Jquery version 1.9 seems not allows trailing comma in selectors. => ".single-line, .test,"
but which seems accepted by version 1.6.
You need to trim last comma in your selector build strings:
'.single-line,.test,'.replace(/,$/,"");
Try you code like this:
var currentRows = '', nextRows = ''; for( var i = 0; i < opts.rows; ++i ) { currentRows += '.tj_row_' + (config.currentRow + i) + ','; (dir === 1) ? nextRows += '.tj_row_' + (config.currentRow + opts.rows + i) + ',' : nextRows += '.tj_row_' + (config.currentRow - 1 - i) + ','; } currentRows = currentRows.replace(/,$/,""); nextRows = nextRows.replace(/,$/,"");
Dec 08, 2016 12:49 AM|issam1975|LINK
and that did the trick :)
many many thanks raju dasa, thanks cathy to you too :)
Member
12 Points
165 Posts
upgrade some code to a newer version of jquery
Dec 06, 2016 11:52 PM|issam1975|LINK
hi,
i have some trouble with a plugin that work with an older version of jquery but not with newers :/
it's originally from this page
http://tympanus.net/codrops/2011/06/09/grid-navigation-effects/
after some debugging it seems that these lines are guilty :
the error in the console is
if i comment them i don't have the error in the console but the pluging don't work properly .
this lines of code are working perfectly in jquery 1.6.1 but not in 1.9.1
any idea on what's going on and how to fix that please ?
thanks !
Star
8670 Points
2882 Posts
Re: upgrade some code to a newer version of jquery
Dec 07, 2016 07:32 AM|Cathy Zou|LINK
Hi issam1975,
As far as I know, Jquery plugin was created based on some version Jquery,
For your problem, Grid Navigation work on Jquery 1.6.1 not work in 1.9.1. it seems that some method was update or changed in 1.9.1,
I think it is possible to make change in Jquery plugin to fix the problem.
As far as I know, Jquery provide conflict method, which allow us could use multiple Jquery at some time,
So, I suggest could use this method to use the two version Jquery.
https://api.jquery.com/jquery.noconflict/
Best regards
Cathy
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
All-Star
15186 Points
3888 Posts
Re: upgrade some code to a newer version of jquery
Dec 07, 2016 09:32 AM|raju dasa|LINK
Hi,
Jquery version 1.9 seems not allows trailing comma in selectors. => ".single-line, .test,"
but which seems accepted by version 1.6.
You need to trim last comma in your selector build strings:
'.single-line,.test,'.replace(/,$/,"");
Try you code like this:
rajudasa.blogspot.com || rajudasa-tech
Member
12 Points
165 Posts
Re: upgrade some code to a newer version of jquery
Dec 08, 2016 12:49 AM|issam1975|LINK
and that did the trick :)
many many thanks raju dasa, thanks cathy to you too :)