How to Fix Text Links in the iPhone-Slide Plugin
January 30, 2012
On a previous post I told you all about this amazing plugin I found that would create a slider that takes advantage of the iPad’s touch and drag functionality.
However, if you didn’t use it just for images and had the slides contain text, you may have noticed that the links within the slides would not work. This plugin appears as it was mainly created to swipe through images, and not necessarily for content with text links.
I went into the plugin (jquery.iphone-slide.js) and changed a few things so it would do my bidding:
OLD CODE:
helpers.goto_url(thislink);
NEW CODE:
var thislink = $(event.target).parent("a").attr("href");
if(!thislink){var thislink = $(event.target).attr("href");}
if(thislink){
window.location(thislink); //similar behavior as clicking on a link
}
Turns out the __mouseup function was preventing the default action and the “helpers.goto_url” function only opened image links. But now it’s set up to do everything, Cheers!