Skip to content

Instantly share code, notes, and snippets.

@rivaadara111
Last active March 19, 2018 19:47
Show Gist options
  • Save rivaadara111/f110007bad5e5735d5309d54704bf1a1 to your computer and use it in GitHub Desktop.
Save rivaadara111/f110007bad5e5735d5309d54704bf1a1 to your computer and use it in GitHub Desktop.
(function($) {
// object constructor that creates itself and inserts itself onto the page
function Subscribe(whereIam) {
var self = this;
this.create_box = function(){
self.letterBlock = document.createElement('div');
self.letterBlock.setAttribute("id", "box--social");
self.letterBlock.className += 'box box--social sans-pro';
$(self.letterBlock).appendTo($('.sidebar', whereIam));
};
this.html = function() {
$(".box--social").load("/sites/all/modules/custom/gs_socialmedia/templates/newsletter.htm", function(){
$(this).find('.center-gif').remove();
});
};
this.create_box();
var boxsocial = this.letterBlock;
this.trigger = new Waypoint({
element: boxsocial,
handler: function(direction) {
this.destroy();
self.html();
console.log('waypoint fired');
},
offset: 'bottom-in-view'
});
this.casl_conset = function() {
document.getElementById('mce-group[5057]-5057-0').checked = true;
}
}
window.Subscribe = Subscribe;
var first_newsletter = new Subscribe();
})(jQuery);
//called from waypoints for infinite scroll items
function insertNewsletter(content){
var whereIam = jQuery('.content', content);
var newsletter = new Subscribe(whereIam);
window.letter_storage.push(newsletter);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment