binders.js 531 B

123456789101112131415161718192021
  1. rivets.binders['src-strict'] = function(el, value) {
  2. var img = new Image()
  3. img.onload = function() {
  4. $(el).attr('src', value)
  5. }
  6. img.src = value
  7. }
  8. rivets.binders['transition'] = function(el, display) {
  9. if (display) {
  10. el.classList.remove('hide');
  11. setTimeout(function() {
  12. el.classList.add('show');
  13. }, 0);
  14. } else {
  15. el.classList.remove('show');
  16. setTimeout(function() {
  17. el.classList.add('hide');
  18. }, 200);
  19. }
  20. }