Skip to content

Instantly share code, notes, and snippets.

@alex-boom
Last active July 20, 2016 13:23
Show Gist options
  • Save alex-boom/e58f96d77dd97504839f542be5bf7503 to your computer and use it in GitHub Desktop.
Save alex-boom/e58f96d77dd97504839f542be5bf7503 to your computer and use it in GitHub Desktop.
Разное
import HP from './helpers';
(function ($) {
// При нажатии на кнопку редирект на страницу Гугл
$(".submit-btn").click(function() {
location.href ='http://google.com';
});
//Второй вариант, можно задать путь на страницу через дата атрибут в штмл теге (<input id="button" data-href="http://google.com" value="Я ссылко"/>)
$('#content1').click(function() {
location.href = $(this).attr('data-href'); редирект
});
//редирект по истечении времени на другую страницу
function second_passed() {
var url = "http://google.com";
$(location).attr('href',url);
};
setTimeout(second_passed, 180000);
//или такой вариант редиректа
function GoThanks(){
location="http://testall.grytsenko.in.ua/foursoft/thanks.html";
}
setTimeout( 'GoThanks()', 180000 );
//отправить данные аяксом на мейл пхп и после сделать редирект на другую страницу
$("#callback_form").submit(function() {
$.ajax({
type: "POST",
url: "mail.php",
data: $(this).serialize(),
});
$.ajax({/* ... */}).done(function(result) {
//переход
alert("Спасибо за заявку!");
setTimeout(function() {
}, 1000);
$("#callback_form").trigger("reset");
window.location.href = "#"; //редирект на другую страницу.
});
return false;
});
//открывается закрывается по клику можно использовать для дропдаун меню
$("#dropmenu").click(function() {
$("#submenu").slideToggle(100);
});
//ссылку открывает в новом окне браузера, метод open вкючает в себя множество доп. параметров, окно можно так же прицепить к любому событию
var NewWin = open('http://www.google.com/', 'theWin', 'width=300,height=300');
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment