softwaretailoring / wheelnav

Animated wheel navigation JavaScript library based on Raphaël.js (SVG/VML). It can be a pie menu (radial menu, circular menu) and many more.
https://wheelnavjs.softwaretailoring.net
MIT License
702 stars 101 forks source link

How to add NavItemImg using JavaScript #60

Closed ozeone closed 7 years ago

ozeone commented 7 years ago

Hi, I am trying to switch from using the HTML 5 tags to initilaize WeheelNav to using JavaScript. I got everything working except the data-wheelnav-navitemimg, how can i do this using JavaScript?

HTML 5 tags i want to replace

<div id="divWheel"
        data-wheelnav
        data-wheelnav-titlewidth="45"
        data-wheelnav-titleheight="45"
        data-wheelnav-slicepath="CogSlice"
        data-wheelnav-spreaderradius="20"
        data-wheelnav-navangle="180"
        data-wheelnav-slicetransform="RotateTitleTransform"
        data-wheelnav-wheelradius="105">
    <div data-wheelnav-navitemimg="@Url.CloudUrl("/assets/dashboard/icon-mok.png")" onmouseup="setUser('#tab-mok');"></div>
    <div data-wheelnav-navitemimg="@Url.CloudUrl("/assets/dashboard/icon-kevin.png")" onmouseup="setUser('#tab-kevin');"></div>
    <div data-wheelnav-navitemimg="@Url.CloudUrl("/assets/dashboard/icon-henrik.png")" onmouseup="setUser('#tab-henrik');"></div>
    <div data-wheelnav-navitemimg="@Url.CloudUrl("/assets/dashboard/icon-anna.png")" onmouseup="setUser('#tab-anna');"></div>
</div>

Javascript i am using (see my failed try to use image)

var wheel = new wheelnav("divWheel");
wheel.selectedNavItemIndex = null;
wheel.initWheel(["<img src=\"test.gif\" />", "create", "navigate", "refresh"]);
wheel.wheelRadius = 105;
wheel.navAngle = 180;
wheel.titleWidth = 45;
wheel.titleHeight = 45;
wheel.spreaderRadius = 20;
wheel.slicePathFunction = slicePath().CogSlice;
wheel.createWheel();

What am i missing here?

Oh, Thanks again for an awesome script

softwaretailoring commented 7 years ago

Click here and click the 'icons' button. :)

wheel.initWheel(["imgsrc:test.gif", "create", "navigate", "refresh"]);