javascript - Re-bind jquery plugin to selector after property change? -


i've created simple gallery product page. product can have multiple images, decided put big featured image above , show thumbnails below. when click thumbnails, big featured image update show bigger version of thumbnail. works fine. problem want use jquery plugin called loupe, adds magnifying functionality featured image. kind of works, when change featured image (by clicking thumbnail), loupe plugin doesn't recognize source change, , still shows previous image overlay.

see codepen: http://codepen.io/vobpler/pen/klfeb edit: jsfiddle link in case above isn't working: http://jsfiddle.net/c8bxe/

here's markup:

<div class="featured">     <a href="">         <img src="" alt="">     </a> </div>  <div class="thumbnails">     <a href="">         <img src="" alt="">     </a>     <a href="">         <img src="" alt="">     </a>     <a href="">         <img src="" alt="">     </a> </div> 

is there way "unload" loupe, , re-attach after featured image changes? tried re-applying after source changes didn't anything.

after looking @ plugin's code , doing inspecting see need add following line @ end of fullimg.load() handler:

$('.loupe > img').prop('src', fullsrc); 

see working fiddle


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -