Вход Регистрация
* -=(C)DRU987=- (Dev)

Плавная смена картинки

  1. jQuery.noConflict();
  2.  
  3. jQuery(document).ready(function($){
  4.  
  5. var backgroundElements = '#branding';
  6.  
  7. $("#themeEditor #editPattern span").click(function(){
  8. var backgroundPattern = $(this).attr("data-pattern");
  9. var backgroundRepeat = $(this).attr("data-backgroundRepeat");
  10. var backgroundPosition = $(this).attr("data-backgroundPosition");
  11. var backgroundAttach = $(this).attr("data-backgroundAttach");
  12. var noHeaderImage = $(this).attr("data-noHeaderImage");
  13. var backgroundClasses = backgroundRepeat + " " + backgroundPosition + " " + backgroundAttach + " " + noHeaderImage;
  14. $(backgroundElements).removeClass("repeat repeat-x repeat-y scroll fixed centerCenter topCenter noHeaderImage").addClass(" " + backgroundClasses).css("background-image", "url({style_images_url}/patterns/" + backgroundPattern + ")");
  15. $.cookie('customPattern',backgroundPattern,{ expires: 365, path: '/'});
  16. $.cookie('backgroundClasses',backgroundClasses,{ expires: 365, path: '/'});
  17. });
  18.  
  19. if ( ($.cookie('customPattern') != null)){
  20. $(backgroundElements).removeClass("repeat repeat-x repeat-y scroll fixed centerCenter topCenter noHeaderImage").addClass(" " + $.cookie('backgroundClasses')).css("background-image", "url({style_images_url}/patterns/" + $.cookie('customPattern') + ")");
  21. }
  22. else{
  23. $(backgroundElements).addClass("no-repeat centerCenter fixed").css("background-image","url({style_images_url}/patterns/stardust.png)");
  24. }
  25.  
  26. });
» Описание: Очень простенький кусок кода, всё понятно
» Время добавления: 26 Фев 2016 в 20:41
» Посмотров: 1933
» textarea
» Рейтинг: [+1 | -0]
Комментарии [0]
Онлайн: 1
Реклама