[For 1.8] jQuery color picker
#39
ok..., so now that we have the colorpicker for our members on the lower panel..., do we want to stop there? Or do we want more! Smile I will explain this shortly....  

Example:
[Image: 2nuopye.png]


Ok, since you are already familiar with the process from adding the colorpicker as described above..., we will jump right into this.

PART 2:


Edit Template: headerinclude

Find: *
<!-- Colorpick -->
<script type="text/javascript" src="{$mybb->asset_url}/themes/colorize/picker/js/colorpicker.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/themes/colorize/picker/js/skin.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/themes/colorize/picker/js/cookie.js"></script>

* adjust the links to your theme..., as this example is based on the theme.xml I provided earlier in the tutorial

Though I have found that:
<script type="text/javascript" src="{$mybb->asset_url}/themes/colorize/picker/js/cookie.js"></script>
is not necessarily needed...

Add after: *
<!-- Colorpick BG Preview-->
<script type="text/javascript">
$(document).ready(function(){    
    if($.cookie('background')){     
        $("body").css("backgroundImage", "url(" + "themes/colorize/picker/bg/" + $.cookie("background") + ".png)");
    };
    $(".bg_style").click(function () {  
         $(".bg_preview").slideToggle('fast');
         return false;
    });
    $(".bg_preview a").click(function() {
        var bg_id = $(this).attr("id");
          $("body").css("backgroundImage", "url(" + "themes/colorize/picker/bg/" + bg_id + ".png)");
        $.cookie('background', bg_id, { expires: 365, path: '/' });
    });    
});
</script> 
* adjust the links to your theme..., as this example is based on the theme.xml I provided earlier in the tutorial

Edit Template: header_welcomeblock_member

Find:
            <li><a href="{$mybb->settings['bburl']}/private.php">{$lang->welcome_pms}</a> {$lang->welcome_pms_usage}</li>
        </ul>
    </div>


after add: *
                    <div class="wrapper">        
                    <div class="bg_preview">
                            <a id="bg1" href="#" style="background: url('themes/colorize/picker/bg/bg1.png');"></a>
                            <a id="bg2" href="#" style="background: url('themes/colorize/picker/bg/bg2.png');"></a>
                            <a id="bg3" href="#" style="background: url('themes/colorize/picker/bg/bg3.png');"></a>
                            <a id="bg4" href="#" style="background: url('themes/colorize/picker/bg/bg4.png');"></a>
                            <a id="bg5" href="#" style="background: url('themes/colorize/picker/bg/bg5.png');"></a>
                            <a id="bg6" href="#" style="background: url('themes/colorize/picker/bg/bg6.png');"></a>
                            <a id="bg7" href="#" style="background: url('themes/colorize/picker/bg/bg7.png');"></a>
                            <a id="bg8" href="#" style="background: url('themes/colorize/picker/bg/bg8.png');"></a>
                            <a id="bg9" href="#" style="background: url('themes/colorize/picker/bg/bg9.png');"></a>
                            <a id="bg10" href="#" style="background: url('themes/colorize/picker/bg/bg10.png');"></a>
                       </div>
            </div>     

* adjust the links to your theme..., as this example is based on the theme.xml I provided earlier in the tutorial

Now also find:
        <ul class="menu panel_links">
            <span class="custom_theme"><input type="text" id="colorpicker" ></span>

after add:
         <span class="bg_style"><input type="text" id="bg_preview" ></span>

Now, finish up by adding the css by going to cp.css


Editing cp.css
<!-- BG Preview -->

.bg_style {
    background: url('themes/colorize/picker/bg/palette.png') top left no-repeat;
    float: left;
}

.bg_style #bg_preview {
    height: 12px;
    width: 12px;
    padding: 0;
    margin: 0;
    cursor: pointer;
    opacity: 0;
}

.bg_preview {
    width: 356px;
    height: 176px;
    overflow: hidden;
    position: absolute;
    background: #EFEFEF;
    border: 1px solid #ccc;
    font-family: Arial, Helvetica, sans-serif;
    display: none;
    z-index: 9000;
    margin-left: 36px;
}
* adjust the links to your theme..., as this example is based on the theme.xml I provided earlier in the tutorial

Now, go into your themes global.css and find and comment out the background color for content:
#content {
/* background: #fff; */
}

The final step is to add the images....,

.zip   bg.zip (Size: 570.55 KB / Downloads: 101)

Download, extract and place the "bg" folder in your "picker" folder.

ie:

themes/colorize/picker/bg

example of what you should now have:

[Image: 2rxg0vr.png]



* For those of you having any such trouble with this..., here it is working and included in a slightly modified version of the default theme just in case anyone was in need of such...., logged in users will notice the option for colorpicker and bg preview in their lower panel. *note: this is not the theme provided in the earlier post..., this is updated to add the bg-preview!

.zip   Colorize_Dev.zip (Size: 900.01 KB / Downloads: 104)
Reply


Messages In This Thread
jQuery color picker - by iAndrew - 2014-09-07, 08:12 PM
RE: jQuery color picker - by Destroy666 - 2014-09-07, 08:51 PM
RE: jQuery color picker - by effone - 2014-09-08, 09:30 AM
RE: jQuery color picker - by iAndrew - 2014-09-08, 05:02 PM
RE: jQuery color picker - by JonathanP - 2014-09-08, 10:56 PM
RE: jQuery color picker - by iAndrew - 2014-09-09, 03:55 PM
RE: jQuery color picker - by JonathanP - 2014-09-09, 10:48 PM
RE: jQuery color picker - by iAndrew - 2014-09-10, 02:15 AM
RE: jQuery color picker - by JonathanP - 2014-09-10, 12:24 PM
RE: jQuery color picker - by Destroy666 - 2014-09-12, 05:59 PM
RE: jQuery color picker - by eNvy - 2014-09-10, 03:34 PM
RE: jQuery color picker - by Nolan - 2014-09-15, 01:47 PM
RE: jQuery color picker - by Billie Joe Armstrong - 2014-09-19, 04:13 PM
RE: jQuery color picker - by jason5 - 2014-10-04, 07:07 AM
RE: jQuery color picker - by Anonymous™ - 2014-10-05, 12:43 PM
RE: jQuery color picker - by GamesPuff - 2014-12-28, 06:37 AM
RE: jQuery color picker - by ElectricShock - 2014-12-28, 01:45 PM
RE: jQuery color picker - by GamesPuff - 2014-12-28, 04:56 PM
RE: jQuery color picker - by GamesPuff - 2014-12-30, 07:00 AM
RE: jQuery color picker - by Destroy666 - 2015-01-04, 12:16 AM
RE: jQuery color picker - by nollidnosnhoj - 2015-04-07, 04:25 AM
RE: jQuery color picker - by Dragonexsperm - 2015-04-09, 04:06 AM
RE: jQuery color picker - by Lektz - 2015-05-31, 10:04 PM
RE: jQuery color picker - by Cookie123 - 2015-06-09, 01:36 AM
RE: jQuery color picker - by Billie Joe Armstrong - 2015-06-21, 02:21 PM
RE: jQuery color picker - by Cookie123 - 2015-06-22, 02:04 AM
RE: jQuery color picker - by .m. - 2015-06-22, 03:14 AM
RE: jQuery color picker - by Cookie123 - 2015-06-22, 03:21 AM
RE: jQuery color picker - by .m. - 2015-06-22, 03:30 AM
RE: jQuery color picker - by Cookie123 - 2015-06-22, 03:33 AM
RE: jQuery color picker - by .m. - 2015-06-22, 03:56 AM
RE: jQuery color picker - by Cookie123 - 2015-06-22, 04:07 AM
RE: jQuery color picker - by .m. - 2015-06-22, 04:18 AM
RE: jQuery color picker - by Cookie123 - 2015-06-22, 04:21 AM
RE: jQuery color picker - by Claraviolet - 2015-09-23, 05:44 AM
RE: jQuery color picker - by Restia - 2015-09-28, 03:33 PM
RE: jQuery color picker - by Wires - 2015-10-16, 08:50 PM
RE: jQuery color picker - by User 6029 - 2016-11-15, 11:54 AM
RE: jQuery color picker - by User 6029 - 2016-11-19, 02:20 AM
RE: jQuery color picker - by thelovelyone - 2016-11-20, 12:23 AM
RE: jQuery color picker - by User 6029 - 2016-11-20, 01:12 AM
RE: jQuery color picker - by thelovelyone - 2016-11-20, 01:52 AM
RE: jQuery color picker - by User 6029 - 2016-11-20, 02:12 AM
RE: jQuery color picker - by thelovelyone - 2016-11-20, 12:19 PM
RE: jQuery color picker - by User 6029 - 2016-11-20, 10:21 PM
RE: jQuery color picker - by thelovelyone - 2016-11-20, 10:53 PM
RE: jQuery color picker - by User 6029 - 2016-11-20, 11:19 PM
RE: jQuery color picker - by thelovelyone - 2016-11-20, 11:24 PM
RE: jQuery color picker - by User 6029 - 2016-11-21, 03:31 PM
RE: jQuery color picker - by thelovelyone - 2016-11-21, 08:26 PM
RE: jQuery color picker - by User 6029 - 2016-11-21, 08:36 PM
RE: jQuery color picker - by Sgt Cheesepuffs - 2016-12-07, 11:16 PM
RE: jQuery color picker - by User 6029 - 2016-12-08, 04:56 AM
RE: jQuery color picker - by Sgt Cheesepuffs - 2016-12-12, 02:32 PM
RE: jQuery color picker - by thelovelyone - 2016-12-13, 06:05 PM
RE: jQuery color picker - by [AoW]Sauron - 2018-07-17, 11:25 PM
RE: jQuery color picker - by sappy - 2020-02-09, 08:32 AM
RE: jQuery color picker - by User 6029 - 2020-02-09, 04:55 PM
RE: jQuery color picker - by sappy - 2020-02-16, 09:43 AM
RE: jQuery color picker - by User 6029 - 2020-02-16, 07:34 PM
RE: jQuery color picker - by sappy - 2020-02-17, 04:09 PM
RE: jQuery color picker - by User 6029 - 2020-02-17, 09:04 PM
RE: jQuery color picker - by sappy - 2020-02-18, 01:16 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)