Skip to content

Instantly share code, notes, and snippets.

@hoosteeno
Created July 12, 2017 22:50
Show Gist options
  • Save hoosteeno/c9bdb3d5bc9609b18bffcdbefaf4fc80 to your computer and use it in GitHub Desktop.
Save hoosteeno/c9bdb3d5bc9609b18bffcdbefaf4fc80 to your computer and use it in GitHub Desktop.
var $oldList = $('.download-list');
var $nowList = $oldList.clone();
var $laterList = $oldList.clone();
var $style = $('<style>'
+ '.download-list {'
+ 'float:left;'
+ '}'
+ '.download-list:first-of-type {'
+ 'margin-right: 30px;'
+ '}'
+ '@media (max-width: 600px) {'
+ '.download-list {'
+ 'width: 100%;'
+ '}'
+ '}'
+ '</style>');
$('body').append($style);
$nowList.find('.download-title').each(function() {
$(this).text('Download Now');
});
$laterList.find('.download-title').each(function() {
$(this).text('Download Later');
});
$laterList.find('.download-link').each(function() {
$(this).attr('href', 'https://www.mozilla.org/newsletter/firefox/');
$(this).addClass('second-button');
});
var $buttonDiv = $('<div class="section"></div>');
$buttonDiv.append($nowList);
$buttonDiv.append($laterList);
$oldList.replaceWith($buttonDiv);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment