Witam , czy mógłby mi ktoś pomóc przenieś slider z partnerami z szablonu greendark do gromu?
https://cslobby.pl/index.php
https://cslobby.pl/index.php
(14.02.2018, 20:10)Penny napisał(a): Z tego co pamiętam, to slider był wykorzystany stąd:Tylko kompletnie nie ogarniam JS'a.
http://kenwheeler.github.io/slick/
var user_opt_text = usermenu;
var self = myslider = {
delay: 7000,
on: false,
transition_duration: 500,
animating: false,
max_width: 1494,
current: 0,
fit: function() {
if ($(window).innerWidth() > self.max_width) {
self.slide_width = self.max_width;
} else {
self.slide_width = $(window).innerWidth();
}
$(".slider .slides").css("width", self.slides * self.slide_width);
it = self;
$.each($(".slider .slides > div"), function() {
$(this).css("width", it.slide_width);
});
position = (self.current * self.slide_width) * -1;
$(".slider").css("width", self.slide_width);
self.set_position(position);
},
set_position: function(position) {
$(".slider .slides").css("transform", "translate3d(" + position + "px, 0, 0)");
self.animating = true;
setTimeout("self.animating = false;", self.transition_duration);
},
next_slide: function(manually = false) {
next = self.current + 1;
if ($(".slider .slides > div[data-slide=" + next + "]").length == 0) {
next = 0;
position = "0";
} else {
position = (next * self.slide_width) * -1;
}
self.set_position(position);
self.current = next;
if (self.pages == true) {
$(".slider .pages .page.active").removeClass("active");
$(".slider .pages .page[data-slide=" + next + "]").addClass("active");
}
if (manually == true) {
clearInterval(self.interval);
self.set_interval();
}
},
stop_slider: function() {
clearInterval(self.interval);
},
previous_slide: function() {
prev = self.current - 1;
if ($(".slider .slides > div[data-slide=" + prev + "]").length == 0) {
prev = $(".slider .slides > div").last().attr("data-slide");
}
position = (prev * self.slide_width) * -1;
self.set_position(position);
if (self.pages == true) {
$(".slider .pages .page.active").removeClass("active");
$(".slider .pages .page[data-slide=" + next_id + "]").addClass("active");
}
self.current = prev;
clearInterval(self.interval);
self.set_interval();
},
set_interval: function() {
self.interval = setInterval(self.next_slide, self.delay);
},
set_slider: function(pages = false) {
self.slides = $(".slider .slides > div").length;
self.fit();
$(".slider .slides > div").each(function(key) {
$(this).attr("data-slide", key);
});
$(".slider .slides").css("width", self.slides_width);
if (pages == true) {
self.make_pagination();
$(".slider .pages .page[data-slide=0]").addClass("active");
}
self.pages = pages;
self.on = true;
self.set_interval();
},
make_pagination: function() {
$(".slider .slides > div").each(function(index) {
id = index;
$(this).attr("data-slide", id);
$(".slider .pages").append("<div class='page' data-slide='" + id + "'></div>");
});
}
}
$(document).ready(function() {
myslider.set_slider();
$(window).resize(function() {
myslider.fit();
});
$('.partners-container').slick({
slidesToShow: 3,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 2000,
});
$(".partners").show();
$("header").prepend("<div class='mobile-container'><div class='mobile-container-bg'></div><div class='mobile-menus'><ul class='user-menu'></ul><ul class='forum-menu'></ul></div></div>")
user_menu = $("ul.user-panel").html();
user2 = $("ul.user2").html();
forum_menu = $("header .top .left ul.menu").html();
$("header").prepend("<div class='mobile-menus-open'><i class='fa fa-bars'></i></div>");
$(".mobile-menus .user-menu").append(user_menu);
$(".mobile-menus .user-menu li.user-menu span").removeAttr("data-dropdown").removeClass().addClass("sm-link").html(user_opt_text);
$(".mobile-menus .user-menu li.user-menu > ul").removeAttr("data-dropdown").removeClass().addClass("sm-ul");
$(".mobile-menus .user-menu li.user-menu").removeClass();
$(".mobile-menus .user-menu li.imp-menu").prependTo(".mobile-menus .user-menu");
$(".mobile-menus .user-menu li.imp-menu ul").prepend("<li class='close-menus'><i class='fa fa-times-circle'></i></li>");
$(".mobile-menus .forum-menu").append(forum_menu);
$(".mobile-menus .forum-menu").append(user2);
$(".mobile-menus-open i").click(function() {
$(".mobile-container-bg").css({
visibility: "visible"
});
$(".mobile-menus").css({
right: 0,
visibility: "visible"
});
});
$('.mobile-container-bg').click(function() {
$(".mobile-menus").css({
right: "-300px"
});
setTimeout("$('.mobile-container-bg').css({visibility: 'hidden'});$('.mobile-menus').css({visibility: 'hidden'})", 600);
});
$(".mobile-menus .close-menus").click(function() {
$(".mobile-menus").css({
right: "-300px"
});
setTimeout("$('.mobile-container-bg').css({visibility: 'hidden'});$('.mobile-menus').css({visibility: 'hidden'})", 600);
});
$(".slider .buttons .previous").click(function() {
myslider.previous_slide();
});
$(".slider .buttons .next").click(function() {
myslider.next_slide(true);
});
$(".mobile-menus .sm-link").click(function() {
console.log("d");
$(this).siblings("ul").fadeToggle();
});
$(".slider .pages .page").click(function() {
id = $(this).attr("data-slide");
if ($(".slider .pages .page[data-slide=" + id + "]").hasClass("active") == 0) {
position = $(this).attr("data-slide") * -100;
$(".slider .slides").css("transform", "translate3d(" + position + "vw, 0, 0)");
$(".slider .pages .page.active").removeClass("active");
$(".slider .pages .page[data-slide=" + id + "]").addClass("active");
}
});
$(".login span").click(function() {
if ($(window).innerWidth() > 1080) {
$("body").css("overflow", "hidden");
$(".user-panel .login-box-index").fadeIn();
$(".user-panel .login-box").fadeIn();
} else {
window.location.href = rootpath + "/member.php?action=login";
}
});
$(".login-box .close").click(function() {
$("body").css("overflow", "auto");
$(".login-box-index").fadeOut();
$(".login-box").fadeOut();
});
$(".login-box-index").click(function() {
$("body").css("overflow", "auto");
$(".login-box-index").fadeOut();
$(".login-box").fadeOut();
});
$("footer .up .button").click(function() {
$("html, body").animate({
scrollTop: 0
}, "slow");
});
$(".read-all a").attr("href", "misc.php?action=markread&my_post_key=" + my_post_key);
$(document).on('click', '.dropdown-overlay', function() {
dropdown_name = $(this).data("dropdown");
$("ul[data-dropdown=" + dropdown_name + "]").fadeOut();
$(this).remove()
});
$(".dropdown-link").click(function() {
dropdown_name = $(this).data("dropdown");
$("body").append("<div class=\"dropdown-overlay\" data-dropdown=\"" + dropdown_name + "\"></div>");
$("ul[data-dropdown=" + dropdown_name + "]").fadeIn();
});
});
var user_opt_text = usermenu;
(function($) {
$.fn.selectize = function(options) {
var settings = $.extend({
auto_submit: false,
list_direction: "bottom",
}, options);
return this.each(function() {
var s = $(this);
if(s.is("select")) {
s.hide();
var id = s.attr("name");
var n = s.attr("data-select-name");
s.parent().append("<div class='selectize selectize--"+settings.list_direction+"' data-id='"+id+"'><div class='selectize__open'>"+n+"</div><div class='selectize__options'></div></div>");
var h = s.siblings(".selectize[data-id="+id+"]");
if(s.find("option").length > 0) {
s.find("option").each(function() {
var c = $(this);
h.find(".selectize__options").append("<div class='selectize__options__option' data-name='"+c.attr('value')+"'>"+c.text()+"</div>");
}).promise().done(function() {
h.on('click', ".selectize__open", function() {
h.addClass("selectize--opened");
$("body").append("<div class='selectize__overlay'></diV>");
});
$("body").on('click', ".selectize__overlay", function() {
$(".selectize.selectize--opened").removeClass("selectize--opened");
$(".selectize__overlay").detach();
});
h.on('click', ".selectize__options__option", function() {
s.val($(this).attr("data-name"));
if(settings.auto_submit == true) {
s.parents('form:first').submit();
}
});
});
}
}
});
}
})(jQuery);
$(document).ready(function() {
$("header").prepend("<div class='mobile-container'><div class='mobile-container-bg'></div><div class='mobile-menus'><ul class='user-menu'></ul><ul class='forum-menu'></ul></div></div>")
user_menu = $("ul.user-panel").html();
user2 = $("ul.user2").html();
forum_menu = $("header .hd-cont ul.menu").html();
$("header").prepend("<div class='mobile-menus-open'><i class='fa fa-bars'></i></div>");
$(".mobile-menus .user-menu").append(user_menu);
$(".mobile-menus .user-menu li.user-menu span").removeAttr("data-dropdown").removeClass().addClass("sm-link").html(user_opt_text);
$(".mobile-menus .user-menu li.user-menu > ul").removeAttr("data-dropdown").removeClass().addClass("sm-ul");
$(".mobile-menus .user-menu li.user-menu").removeClass();
$(".mobile-menus .user-menu li.imp-menu").prependTo(".mobile-menus .user-menu");
$(".mobile-menus .user-menu li.imp-menu ul").prepend("<li class='close-menus'><i class='fa fa-times-circle'></i></li>");
$(".mobile-menus .forum-menu").append(forum_menu);
$(".mobile-menus .forum-menu").append(user2);
$(".mobile-menus-open i").click(function() {
$(".mobile-container-bg").css({
visibility: "visible"
});
$(".mobile-menus").css({
right: 0,
visibility: "visible"
});
});
$(".mobile-menus .sm-link").click(function() {
console.log("d");
$(this).siblings("ul").fadeToggle();
});
$('.mobile-container-bg').click(function() {
$(".mobile-menus").css({
right: "-300px"
});
setTimeout("$('.mobile-container-bg').css({visibility: 'hidden'});$('.mobile-menus').css({visibility: 'hidden'})", 600);
});
$(".mobile-menus .close-menus").click(function() {
$(".mobile-menus").css({
right: "-300px"
});
setTimeout("$('.mobile-container-bg').css({visibility: 'hidden'});$('.mobile-menus').css({visibility: 'hidden'})", 600);
});
$(".login span").click(function() {
if ($(window).innerWidth() > 1080) {
$("body").css("overflow-y", "hidden");
$(".user-panel .login-box-index").fadeIn();
$(".user-panel .login-box").fadeIn();
} else {
window.location.href = rootpath + "/member.php?action=login";
}
});
$(".login-box .close").click(function() {
$("body").css("overflow-y", "auto");
$(".login-box-index").fadeOut();
$(".login-box").fadeOut();
});
$(".login-box-index").click(function() {
$("body").css("overflow-y", "auto");
$(".login-box-index").fadeOut();
$(".login-box").fadeOut();
});
$(".footer__btt").click(function() {
$("html, body").animate({
scrollTop: 0
}, "slow");
});
$(".read-all a").attr("href", "misc.php?action=markread&my_post_key=" + my_post_key);
$(document).on('click', '.dropdown-overlay', function() {
dropdown_name = $(this).data("dropdown");
$("ul[data-dropdown=" + dropdown_name + "]").fadeOut();
$(this).remove()
});
$(".dropdown-link").click(function() {
dropdown_name = $(this).data("dropdown");
$("body").append("<div class=\"dropdown-overlay\" data-dropdown=\"" + dropdown_name + "\"></div>");
$("ul[data-dropdown=" + dropdown_name + "]").fadeIn();
});
$("footer select").selectize({auto_submit: true, list_direction: "top"});
});
var user_opt_text = usermenu;
(function($) {
$.fn.selectize = function(options) {
var settings = $.extend({
auto_submit: false,
list_direction: "bottom",
}, options);
return this.each(function() {
var s = $(this);
if(s.is("select")) {
s.hide();
var id = s.attr("name");
var n = s.attr("data-select-name");
s.parent().append("<div class='selectize selectize--"+settings.list_direction+"' data-id='"+id+"'><div class='selectize__open'>"+n+"</div><div class='selectize__options'></div></div>");
var h = s.siblings(".selectize[data-id="+id+"]");
if(s.find("option").length > 0) {
s.find("option").each(function() {
var c = $(this);
h.find(".selectize__options").append("<div class='selectize__options__option' data-name='"+c.attr('value')+"'>"+c.text()+"</div>");
}).promise().done(function() {
h.on('click', ".selectize__open", function() {
h.addClass("selectize--opened");
$("body").append("<div class='selectize__overlay'></diV>");
});
$("body").on('click', ".selectize__overlay", function() {
$(".selectize.selectize--opened").removeClass("selectize--opened");
$(".selectize__overlay").detach();
});
h.on('click', ".selectize__options__option", function() {
s.val($(this).attr("data-name"));
if(settings.auto_submit == true) {
s.parents('form:first').submit();
}
});
});
}
}
});
}
})(jQuery);
$(document).ready(function() {
$("header").prepend("<div class='mobile-container'><div class='mobile-container-bg'></div><div class='mobile-menus'><ul class='user-menu'></ul><ul class='forum-menu'></ul></div></div>")
user_menu = $("ul.user-panel").html();
user2 = $("ul.user2").html();
forum_menu = $("header .hd-cont ul.menu").html();
$("header").prepend("<div class='mobile-menus-open'><i class='fa fa-bars'></i></div>");
$(".mobile-menus .user-menu").append(user_menu);
$(".mobile-menus .user-menu li.user-menu span").removeAttr("data-dropdown").removeClass().addClass("sm-link").html(user_opt_text);
$(".mobile-menus .user-menu li.user-menu > ul").removeAttr("data-dropdown").removeClass().addClass("sm-ul");
$(".mobile-menus .user-menu li.user-menu").removeClass();
$(".mobile-menus .user-menu li.imp-menu").prependTo(".mobile-menus .user-menu");
$(".mobile-menus .user-menu li.imp-menu ul").prepend("<li class='close-menus'><i class='fa fa-times-circle'></i></li>");
$(".mobile-menus .forum-menu").append(forum_menu);
$(".mobile-menus .forum-menu").append(user2);
$(".mobile-menus-open i").click(function() {
$(".mobile-container-bg").css({
visibility: "visible"
});
$(".mobile-menus").css({
right: 0,
visibility: "visible"
});
});
$(".mobile-menus .sm-link").click(function() {
console.log("d");
$(this).siblings("ul").fadeToggle();
});
$('.mobile-container-bg').click(function() {
$(".mobile-menus").css({
right: "-300px"
});
setTimeout("$('.mobile-container-bg').css({visibility: 'hidden'});$('.mobile-menus').css({visibility: 'hidden'})", 600);
});
$(".mobile-menus .close-menus").click(function() {
$(".mobile-menus").css({
right: "-300px"
});
setTimeout("$('.mobile-container-bg').css({visibility: 'hidden'});$('.mobile-menus').css({visibility: 'hidden'})", 600);
});
$(".slider .buttons .previous").click(function() {
myslider.previous_slide();
});
$(".slider .buttons .next").click(function() {
myslider.next_slide(true);
});
$(".slider .pages .page").click(function() {
id = $(this).attr("data-slide");
if ($(".slider .pages .page[data-slide=" + id + "]").hasClass("active") == 0) {
position = $(this).attr("data-slide") * -100;
$(".slider .slides").css("transform", "translate3d(" + position + "vw, 0, 0)");
$(".slider .pages .page.active").removeClass("active");
$(".slider .pages .page[data-slide=" + id + "]").addClass("active");
}
});
$(".login span").click(function() {
if ($(window).innerWidth() > 1080) {
$("body").css("overflow-y", "hidden");
$(".user-panel .login-box-index").fadeIn();
$(".user-panel .login-box").fadeIn();
} else {
window.location.href = rootpath + "/member.php?action=login";
}
});
$(".login-box .close").click(function() {
$("body").css("overflow-y", "auto");
$(".login-box-index").fadeOut();
$(".login-box").fadeOut();
});
$(".login-box-index").click(function() {
$("body").css("overflow-y", "auto");
$(".login-box-index").fadeOut();
$(".login-box").fadeOut();
});
$(".footer__btt").click(function() {
$("html, body").animate({
scrollTop: 0
}, "slow");
});
$(".read-all a").attr("href", "misc.php?action=markread&my_post_key=" + my_post_key);
$(document).on('click', '.dropdown-overlay', function() {
dropdown_name = $(this).data("dropdown");
$("ul[data-dropdown=" + dropdown_name + "]").fadeOut();
$(this).remove()
});
$(".dropdown-link").click(function() {
dropdown_name = $(this).data("dropdown");
$("body").append("<div class=\"dropdown-overlay\" data-dropdown=\"" + dropdown_name + "\"></div>");
$("ul[data-dropdown=" + dropdown_name + "]").fadeIn();
});
$("footer select").selectize({auto_submit: true, list_direction: "top"});
});
1 gości