I have these two functions below and for whatever reason the windowedBox function only works when I call it from another function. If I directly call windowedBox(), it wont do anything. If I call getShareButtons(), it calls windowedBox() and works correctly. If anyone knows why this is happening, please help me. 🙁
NOTE:: if you’re wondering why it says $j and not $ its because i set it up that way.
function getShareButtons(){
var postPath = window.location.pathname;
var videoTitle = 'asdf';
var videoURL = 'asdf';
//Output social button attributes
$j(".facebook-share").attr('href', 'asdf');
windowedBox(); <---THIS CALL WORKS
}
function windowedBox() {
$j(".facebook-share, .twitter-share").click(function(){
window.open(this.href, videoTitle, "width=626, height=436", "status=0", "toolbar=0");
return false;
});
}
I guess this is because you are using the variable
which is not declared in this function but in the other one 🙂